2019-04-22 15:01:56 -07:00
|
|
|
# This will work on a new install.
|
|
|
|
# If any changes are needed to the cluster name on an existing install add another function
|
2019-04-23 12:21:00 -07:00
|
|
|
- name: Config - cluster.name 'logging-dev'
|
|
|
|
become: true
|
|
|
|
lineinfile:
|
|
|
|
path: /etc/elasticsearch/elasticsearch.yml
|
|
|
|
regex: '^cluster.name'
|
|
|
|
insertafter: '#cluster.name: my-application'
|
|
|
|
line: 'cluster.name: logging-dev'
|
|
|
|
backup: yes
|
2019-04-22 15:01:56 -07:00
|
|
|
|
|
|
|
# We define the name of the host we are working on
|
|
|
|
- name: Config - node.name
|
2019-04-23 12:21:00 -07:00
|
|
|
become: true
|
|
|
|
lineinfile:
|
|
|
|
path: /etc/elasticsearch/elasticsearch.yml
|
|
|
|
regex: '^node.name'
|
|
|
|
insertafter: '#node.name: node-1'
|
|
|
|
line: "node.name: dev-data-01"
|
|
|
|
|
|
|
|
- name: Config - network.host
|
|
|
|
become: true
|
|
|
|
lineinfile:
|
|
|
|
path: /etc/elasticsearch/elasticsearch.yml
|
|
|
|
regexp: 'network.host:'
|
|
|
|
insertafter: '#network.host:'
|
|
|
|
line: 'network.host: {{ ansible_eno1.ipv4.address }}'
|
|
|
|
|
|
|
|
- name: Config - transport.host
|
|
|
|
become: true
|
|
|
|
lineinfile:
|
|
|
|
path: /etc/elasticsearch/elasticsearch.yml
|
|
|
|
regexp: 'transort.host:'
|
|
|
|
#insertafter: 'http.port: 9200'
|
|
|
|
line: 'transport.host: localhost'
|
|
|
|
state: present
|
|
|
|
#backrefs: yes
|
|
|
|
|
|
|
|
- name: Config - transport.tcp.port
|
|
|
|
become: true
|
|
|
|
lineinfile:
|
|
|
|
path: /etc/elasticsearch/elasticsearch.yml
|
|
|
|
regexp: 'transport.tcp.port:'
|
|
|
|
#insertafter: 'transport.host: localhost'
|
|
|
|
line: 'transport.tcp.port: 9300'
|
|
|
|
state: present
|
|
|
|
backrefs: yes
|
|
|
|
|
|
|
|
- name: Config - node.master
|
|
|
|
become: true
|
|
|
|
lineinfile:
|
|
|
|
path: /etc/elasticsearch/elasticsearch.yml
|
|
|
|
regexp: 'node.master:'
|
|
|
|
insertafter: 'node.name:'
|
|
|
|
line: 'node.master: true'
|
|
|
|
state: present
|
|
|
|
backrefs: yes
|
|
|
|
|
|
|
|
- name: Config - node.data
|
|
|
|
become: true
|
|
|
|
lineinfile:
|
|
|
|
path: /etc/elasticsearch/elasticsearch.yml
|
|
|
|
regexp: 'node.data:'
|
|
|
|
insertafter: 'node.master:'
|
|
|
|
line: 'node.data: true'
|
|
|
|
state: present
|
|
|
|
backrefs: yes
|
2019-04-22 15:01:56 -07:00
|
|
|
|
|
|
|
# Allow 9200 so we can access it over the network
|
|
|
|
- name: Allow port 9200 though UFW
|
2019-04-23 12:21:00 -07:00
|
|
|
become: true
|
|
|
|
ufw:
|
|
|
|
rule: allow
|
|
|
|
port: 9200
|
|
|
|
#name: ElasticSearch
|
|
|
|
|
|
|
|
- name: Allow port 9300 though UFW
|
|
|
|
become: true
|
|
|
|
ufw:
|
|
|
|
rule: allow
|
|
|
|
port: 9300
|
2019-04-22 15:01:56 -07:00
|
|
|
|
|
|
|
- name: Service reload daemon
|
2019-04-23 12:21:00 -07:00
|
|
|
become: true
|
|
|
|
systemd:
|
|
|
|
daemon_reload: yes
|
2019-04-22 15:01:56 -07:00
|
|
|
|
|
|
|
- name: systemd - enable ElasticSearch on startup
|
2019-04-23 12:21:00 -07:00
|
|
|
become: true
|
|
|
|
systemd:
|
|
|
|
name: elasticsearch
|
|
|
|
enabled: yes
|
2019-04-22 15:01:56 -07:00
|
|
|
|
|
|
|
- name: systemd - restart ElasticSearch service
|
2019-04-23 12:21:00 -07:00
|
|
|
become: true
|
|
|
|
systemd:
|
|
|
|
name: elasticsearch
|
|
|
|
state: restarted
|