ansible-roles/ELK/elasticsearch/tasks/main.yml

35 lines
1.3 KiB
YAML
Raw Normal View History

---
- name: Install the elasticsearch repo key
apt_key: url={{ elasticsearch_repo_key }} state=present
tags: [ 'ELK', 'elasticsearch', 'elk' ]
- name: Install the elasticsearch deb repository
apt_repository: repo='{{ elasticsearch_repo }}' state=present update_cache=yes
tags: [ 'ELK', 'elasticsearch', 'elk' ]
- name: Install the elasticsearch deb packages
apt: name='{{ item }}' state=present
with_items: '{{ elasticsearch_packages }}'
tags: [ 'ELK', 'elasticsearch', 'elk' ]
- name: Install the elasticsearch startup default
template: src=elasticsearch-default.j2 dest=/etc/default/elasticsearch owner=root group=elasticsearch mode=0640
notify: Restart elasticsearch
tags: [ 'ELK', 'elasticsearch', 'elk' ]
- name: Install the elasticsearch configuration
template: src=elasticsearch.yml.j2 dest=/etc/elasticsearch/elasticsearch.yml owner=root group=elasticsearch mode=0640
notify: Restart elasticsearch
tags: [ 'ELK', 'elasticsearch', 'elk' ]
- name: Ensure that elasticsearch is enabled and running
service: name=elasticsearch state=started enabled=yes
when: elasticsearch_enabled
tags: [ 'ELK', 'elasticsearch', 'elk' ]
- name: Ensure that elasticsearch is disabled and stopped
service: name=elasticsearch state=stopped enabled=no
when: not elasticsearch_enabled
tags: [ 'ELK', 'elasticsearch', 'elk' ]