From 25ae51e393614e45485c958252c1267ddbcaa7bf Mon Sep 17 00:00:00 2001 From: Tobias Huste Date: Mon, 12 Apr 2021 14:25:04 +0200 Subject: [PATCH] Stop plugin install to fail in check mode (#787) In check mode Ansible is actually not going to execute the command. Therefore, the return code is not defined making the role fail when execute in Ansible check mode. Co-authored-by: Julien Mailleret <8582351+jmlrt@users.noreply.github.com> --- tasks/elasticsearch-plugins.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/elasticsearch-plugins.yml b/tasks/elasticsearch-plugins.yml index 7e1829a..d96ac96 100644 --- a/tasks/elasticsearch-plugins.yml +++ b/tasks/elasticsearch-plugins.yml @@ -67,7 +67,7 @@ become: yes command: "{{es_home}}/bin/elasticsearch-plugin install {{ item.url | default(item.plugin) }} --batch --silent" register: plugin_installed - changed_when: plugin_installed.rc == 0 + changed_when: plugin_installed.rc|default(0) == 0 with_items: "{{ es_plugins }}" when: item.plugin in plugins_to_install notify: restart elasticsearch @@ -75,6 +75,6 @@ CONF_DIR: "{{ es_conf_dir }}" ES_PATH_CONF: "{{ es_conf_dir }}" ES_INCLUDE: "{{ default_file }}" - until: plugin_installed.rc == 0 + until: plugin_installed.rc|default(0) == 0 retries: 5 delay: 5