From cf78fd744d16a44902eb1b6729c1d8f15dfe448d Mon Sep 17 00:00:00 2001 From: Kevin Carter Date: Thu, 14 Jun 2018 18:52:08 -0500 Subject: [PATCH] Add retries to all tasks with external deps The tasks with external deps should all have a retry so to cater for cases of intermittent service interruptions. This change adds retires and tags to of the tasks with external deps. Change-Id: Icd0a8143347bcbffc2a1e0a02da92091b59ed483 Signed-off-by: Kevin Carter --- .../common_task_install_elk_repo.yml | 18 ++++++++++++++++++ .../common_task_install_go1.10.1.yml | 6 ++++++ elk_metrics_6x/installAPMserver.yml | 4 ++++ elk_metrics_6x/installAuditbeat.yml | 4 ++++ elk_metrics_6x/installCurator.yml | 6 ++++++ elk_metrics_6x/installElastic.yml | 12 ++++++++++++ elk_metrics_6x/installFilebeat.yml | 4 ++++ elk_metrics_6x/installHeartbeat.yml | 4 ++++ elk_metrics_6x/installJournalbeat.yml | 4 ++++ elk_metrics_6x/installKibana.yml | 12 ++++++++++++ elk_metrics_6x/installLogstash.yml | 12 ++++++++++++ elk_metrics_6x/installMetricbeat.yml | 4 ++++ elk_metrics_6x/installPacketbeat.yml | 4 ++++ 13 files changed, 94 insertions(+) diff --git a/elk_metrics_6x/common_task_install_elk_repo.yml b/elk_metrics_6x/common_task_install_elk_repo.yml index 3fe3187f..f4a957c9 100644 --- a/elk_metrics_6x/common_task_install_elk_repo.yml +++ b/elk_metrics_6x/common_task_install_elk_repo.yml @@ -17,15 +17,33 @@ apt_key: url: "https://artifacts.elastic.co/GPG-KEY-elasticsearch" state: "{{ ((elk_package_state | default('present')) == 'absent') | ternary('absent', 'present') }}" + register: _apt_task + until: _apt_task is success + retries: 3 + delay: 2 + tags: + - package_install - name: enable apt-transport-https apt: name: apt-transport-https state: present update_cache: yes + register: _apt_task + until: _apt_task is success + retries: 3 + delay: 2 + tags: + - package_install - name: add elk repo to apt sources list apt_repository: repo: "{{ elk_repo.repo }}" state: "{{ elk_repo.state }}" filename: "{{ elk_repo.filename | default(omit) }}" + register: _apt_task + until: _apt_task is success + retries: 3 + delay: 2 + tags: + - package_install diff --git a/elk_metrics_6x/common_task_install_go1.10.1.yml b/elk_metrics_6x/common_task_install_go1.10.1.yml index 71abb7d4..4d389438 100644 --- a/elk_metrics_6x/common_task_install_go1.10.1.yml +++ b/elk_metrics_6x/common_task_install_go1.10.1.yml @@ -25,6 +25,12 @@ url: "https://dl.google.com/go/go1.10.1.linux-amd64.tar.gz" dest: "/opt/go1.10.1.linux-amd64.tar.gz" checksum: "sha256:72d820dec546752e5a8303b33b009079c15c2390ce76d67cf514991646c6127b" + register: _get_task + until: _get_task is success + retries: 3 + delay: 2 + tags: + - package_install - name: Create go directory file: diff --git a/elk_metrics_6x/installAPMserver.yml b/elk_metrics_6x/installAPMserver.yml index bd834336..9952f9ee 100644 --- a/elk_metrics_6x/installAPMserver.yml +++ b/elk_metrics_6x/installAPMserver.yml @@ -23,6 +23,10 @@ update_cache: true with_items: - apm-server + register: _apt_task + until: _apt_task is success + retries: 3 + delay: 2 tags: - package_install diff --git a/elk_metrics_6x/installAuditbeat.yml b/elk_metrics_6x/installAuditbeat.yml index bdf46117..0feb1d93 100644 --- a/elk_metrics_6x/installAuditbeat.yml +++ b/elk_metrics_6x/installAuditbeat.yml @@ -24,6 +24,10 @@ with_items: - audispd-plugins - auditbeat + register: _apt_task + until: _apt_task is success + retries: 3 + delay: 2 tags: - package_install diff --git a/elk_metrics_6x/installCurator.yml b/elk_metrics_6x/installCurator.yml index b1f5853a..7073f2ae 100644 --- a/elk_metrics_6x/installCurator.yml +++ b/elk_metrics_6x/installCurator.yml @@ -41,6 +41,12 @@ state: "{{ elk_package_state | default('present') }}" extra_args: --isolated virtualenv: /opt/elasticsearch-curator + register: _pip_task + until: _pip_task is success + retries: 3 + delay: 2 + tags: + - package_install - name: exit playbook after uninstall meta: end_play diff --git a/elk_metrics_6x/installElastic.yml b/elk_metrics_6x/installElastic.yml index 1afdc5ea..0fcea462 100644 --- a/elk_metrics_6x/installElastic.yml +++ b/elk_metrics_6x/installElastic.yml @@ -71,6 +71,12 @@ state: "{{ elk_package_state | default('present') }}" install_recommends: yes update_cache: yes + register: _apt_task + until: _apt_task is success + retries: 3 + delay: 2 + tags: + - package_install - include_tasks: common_task_install_elk_repo.yml @@ -79,6 +85,12 @@ name: elasticsearch state: "{{ elk_package_state | default('present') }}" update_cache: yes + register: _apt_task + until: _apt_task is success + retries: 3 + delay: 2 + tags: + - package_install - name: Drop elasticsearch conf file template: diff --git a/elk_metrics_6x/installFilebeat.yml b/elk_metrics_6x/installFilebeat.yml index abcb5ced..99afd71a 100644 --- a/elk_metrics_6x/installFilebeat.yml +++ b/elk_metrics_6x/installFilebeat.yml @@ -23,6 +23,10 @@ update_cache: true with_items: - filebeat + register: _apt_task + until: _apt_task is success + retries: 3 + delay: 2 tags: - package_install diff --git a/elk_metrics_6x/installHeartbeat.yml b/elk_metrics_6x/installHeartbeat.yml index 0005dfbe..3ea05f94 100644 --- a/elk_metrics_6x/installHeartbeat.yml +++ b/elk_metrics_6x/installHeartbeat.yml @@ -21,6 +21,10 @@ name: "heartbeat-elastic" state: "{{ elk_package_state | default('present') }}" update_cache: true + register: _apt_task + until: _apt_task is success + retries: 3 + delay: 2 tags: - package_install diff --git a/elk_metrics_6x/installJournalbeat.yml b/elk_metrics_6x/installJournalbeat.yml index d8a0d35b..db66c62f 100644 --- a/elk_metrics_6x/installJournalbeat.yml +++ b/elk_metrics_6x/installJournalbeat.yml @@ -35,6 +35,10 @@ name: "{{ item }}" state: "{{ elk_package_state | default('present') }}" update_cache: true + register: _apt_task + until: _apt_task is success + retries: 3 + delay: 2 with_items: - git - libsystemd-dev diff --git a/elk_metrics_6x/installKibana.yml b/elk_metrics_6x/installKibana.yml index dfb88fc4..603578f7 100644 --- a/elk_metrics_6x/installKibana.yml +++ b/elk_metrics_6x/installKibana.yml @@ -19,6 +19,12 @@ - nginx - apache2-utils - python-passlib + register: _apt_task + until: _apt_task is success + retries: 3 + delay: 2 + tags: + - package_install - name: create kibana user to access web interface htpasswd: @@ -44,6 +50,12 @@ name: kibana state: "{{ elk_package_state | default('present') }}" update_cache: yes + register: _apt_task + until: _apt_task is success + retries: 3 + delay: 2 + tags: + - package_install - name: Drop kibana conf file template: diff --git a/elk_metrics_6x/installLogstash.yml b/elk_metrics_6x/installLogstash.yml index 158a763f..8a492c52 100644 --- a/elk_metrics_6x/installLogstash.yml +++ b/elk_metrics_6x/installLogstash.yml @@ -59,12 +59,24 @@ state: "{{ elk_package_state | default('present') }}" install_recommends: yes update_cache: yes + register: _apt_task + until: _apt_task is success + retries: 3 + delay: 2 + tags: + - package_install - name: Ensure Logstash is installed apt: name: logstash state: "{{ elk_package_state | default('present') }}" update_cache: yes + register: _apt_task + until: _apt_task is success + retries: 3 + delay: 2 + tags: + - package_install - name: Drop Logstash conf for beats input template: diff --git a/elk_metrics_6x/installMetricbeat.yml b/elk_metrics_6x/installMetricbeat.yml index c81fbae6..14d6b9c7 100644 --- a/elk_metrics_6x/installMetricbeat.yml +++ b/elk_metrics_6x/installMetricbeat.yml @@ -21,6 +21,10 @@ name: metricbeat state: "{{ elk_package_state | default('present') }}" update_cache: true + register: _apt_task + until: _apt_task is success + retries: 3 + delay: 2 tags: - package_install diff --git a/elk_metrics_6x/installPacketbeat.yml b/elk_metrics_6x/installPacketbeat.yml index 2b3418d8..2ae59f63 100644 --- a/elk_metrics_6x/installPacketbeat.yml +++ b/elk_metrics_6x/installPacketbeat.yml @@ -24,6 +24,10 @@ with_items: - tcpdump - packetbeat + register: _apt_task + until: _apt_task is success + retries: 3 + delay: 2 tags: - package_install