library/roles/ELK/elasticsearch: Task to install a list of ES plugins.

This commit is contained in:
Andrea Dell'Amico 2016-06-30 16:09:51 +02:00
parent f84c070906
commit 697c6a87d1
4 changed files with 38 additions and 22 deletions

View File

@ -20,3 +20,6 @@ elasticsearch_define_heap_size: False
elasticsearch_heap_size: 2g
elasticsearch_additional_java_opts: ''
elasticsearch_max_open_files: 65535
#elasticsearch_plugins:
# - { name: 'royrusso/elasticsearch-HQ', state: 'present' }

View File

@ -0,0 +1,24 @@
---
- 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' ]

View File

@ -1,26 +1,6 @@
---
- 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' ]
- include: elasticsearch.yml
- include: plugins.yml
- name: Ensure that elasticsearch is enabled and running
service: name=elasticsearch state=started enabled=yes

View File

@ -0,0 +1,9 @@
---
- block:
- name: Manage a list of elasticsearch plugins
elasticsearch_plugin: name="{{ item.name }}" state={{ item.state }} url={{ item.url|default(omit) }} version={{ item.version|default(omit) }}
with_items: '{{ elasticsearch_plugins | default ([]) }}'
when: elasticsearch_plugins is defined
tags: [ 'elasticsearch', 'es_plugins' ]