use become: yes when root is needed

This commit is contained in:
Brad Pitcher 2017-05-12 13:31:50 -07:00
parent 3621561473
commit 024e6caa4b
No known key found for this signature in database
GPG key ID: 9985F03D4EE0AA12
16 changed files with 69 additions and 5 deletions

View file

@ -12,6 +12,7 @@
#List currently installed plugins. We have to list the directories as the list commmand fails if the ES version is different than the plugin version.
- name: Check installed elasticsearch plugins
become: yes
shell: "ls {{es_home}}/plugins {{list_command}}"
register: installed_plugins
changed_when: False
@ -30,6 +31,7 @@
# This removes any currently installed plugins (to prevent errors when reinstalling)
- name: Remove elasticsearch plugins
become: yes
command: "{{es_home}}/bin/elasticsearch-plugin remove {{item}} --silent"
ignore_errors: yes
with_items: "{{ plugins_to_remove | default([]) }}"
@ -41,6 +43,7 @@
ES_INCLUDE: "{{ instance_default_file }}"
- name: Install elasticsearch plugins
become: yes
command: "{{es_home}}/bin/elasticsearch-plugin install {{ item.plugin }} --batch --silent {% if item.proxy_host is defined and item.proxy_host != '' and item.proxy_port is defined and item.proxy_port != ''%} -DproxyHost={{ item.proxy_host }} -DproxyPort={{ item.proxy_port }} {% elif es_proxy_host is defined and es_proxy_host != '' %} -DproxyHost={{ es_proxy_host }} -DproxyPort={{ es_proxy_port }} {% endif %}"
register: plugin_installed
failed_when: "'ERROR' in plugin_installed.stdout"
@ -57,4 +60,5 @@
#Set permissions on plugins directory
- name: Set Plugin Directory Permissions
become: yes
file: state=directory path={{ es_home }}/plugins owner={{ es_user }} group={{ es_group }} recurse=yes