From e3c71a7fd656b1a990b9a3f722cbaaca53d3b384 Mon Sep 17 00:00:00 2001 From: Dale McDiarmid Date: Mon, 29 Aug 2016 16:34:14 +0100 Subject: [PATCH] Using python-httplib2 + retries for yum delays --- handlers/shield/elasticsearch-shield-native.yml | 1 + tasks/elasticsearch-Debian.yml | 5 ++++- tasks/elasticsearch-RedHat.yml | 7 +++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/handlers/shield/elasticsearch-shield-native.yml b/handlers/shield/elasticsearch-shield-native.yml index 5632bd8..52083a5 100644 --- a/handlers/shield/elasticsearch-shield-native.yml +++ b/handlers/shield/elasticsearch-shield-native.yml @@ -72,6 +72,7 @@ uri: url: http://{{es_api_host}}:{{es_api_port}}/_shield/role method: GET + body_format: json user: "{{es_api_basic_auth_username}}" password: "{{es_api_basic_auth_password}}" force_basic_auth: yes diff --git a/tasks/elasticsearch-Debian.yml b/tasks/elasticsearch-Debian.yml index ebda0f5..1457789 100644 --- a/tasks/elasticsearch-Debian.yml +++ b/tasks/elasticsearch-Debian.yml @@ -17,6 +17,9 @@ apt: name=elasticsearch{% if es_version is defined and es_version != "" %}={{ es_version }}{% endif %} state=present force={{force_install}} cache_valid_time=86400 when: es_use_repository register: elasticsearch_install_from_repo + until: '"failed" not in result' + retries: 5 + delay: 10 - name: Debian - Download elasticsearch from url get_url: url={% if es_custom_package_url is defined %}{{ es_custom_package_url }}{% else %}{{ es_package_url }}-{{ es_version }}.deb{% endif %} dest=/tmp/elasticsearch-{{ es_version }}.deb validate_certs=no @@ -29,4 +32,4 @@ # ansible uri module requires httplib2 - name: pip httplib2 - pip: name=httplib2 extra_args="--user" \ No newline at end of file + apt: deb=python-httplib2 \ No newline at end of file diff --git a/tasks/elasticsearch-RedHat.yml b/tasks/elasticsearch-RedHat.yml index db74280..4b124ca 100644 --- a/tasks/elasticsearch-RedHat.yml +++ b/tasks/elasticsearch-RedHat.yml @@ -15,12 +15,15 @@ yum: name=elasticsearch{% if es_version is defined and es_version != "" %}-{{ es_version }}{% endif %} state=present update_cache=yes when: es_use_repository register: elasticsearch_install_from_repo + until: '"failed" not in result' + retries: 5 + delay: 10 - name: RedHat - Install Elasticsearch from url yum: name={% if es_custom_package_url is defined %}{{ es_custom_package_url }}{% else %}{{ es_package_url }}-{{ es_version }}.noarch.rpm{% endif %} state=present when: not es_use_repository register: elasticsearch_install_from_package -# ansible uri module requires httplib2 +# ansible uri module requires python-httplib2 - name: pip httplib2 - pip: name=httplib2 extra_args="--user" \ No newline at end of file + yum: name=python-httplib2 \ No newline at end of file