From dd563423617cfe41ed1d874c7ae03564a7e8454b Mon Sep 17 00:00:00 2001 From: Matthew Mosesohn Date: Fri, 17 Mar 2017 12:55:17 +0300 Subject: [PATCH] Retry yum/apt/rpm download commands, fix succeeded filter --- roles/docker/tasks/main.yml | 4 ++-- roles/download/tasks/main.yml | 4 ++-- roles/kubernetes/preinstall/tasks/main.yml | 14 +++++++++++++- roles/rkt/tasks/install.yml | 4 ++-- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index cdfae8242..09240bf9d 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -34,7 +34,7 @@ keyserver: "{{docker_repo_key_info.keyserver}}" state: present register: keyserver_task_result - until: keyserver_task_result|success + until: keyserver_task_result|succeeded retries: 4 delay: "{{ retry_stagger | random + 3 }}" with_items: "{{ docker_repo_key_info.repo_keys }}" @@ -61,7 +61,7 @@ force: "{{item.force|default(omit)}}" state: present register: docker_task_result - until: docker_task_result|success + until: docker_task_result|succeeded retries: 4 delay: "{{ retry_stagger | random + 3 }}" with_items: "{{ docker_package_info.pkgs }}" diff --git a/roles/download/tasks/main.yml b/roles/download/tasks/main.yml index b4eb79053..37c72462e 100644 --- a/roles/download/tasks/main.yml +++ b/roles/download/tasks/main.yml @@ -92,7 +92,7 @@ - name: Download containers if pull is required or told to always pull command: "{{ docker_bin_dir }}/docker pull {{ pull_args }}" register: pull_task_result - until: pull_task_result|success + until: pull_task_result|succeeded retries: 4 delay: "{{ retry_stagger | random + 3 }}" when: "{{ download.enabled|bool and download.container|bool and pull_required|bool|default(download_always_pull) }}" @@ -150,7 +150,7 @@ delegate_to: localhost become: false register: get_task - until: get_task|success + until: get_task|succeeded retries: 4 delay: "{{ retry_stagger | random + 3 }}" when: (not ansible_os_family in ["CoreOS", "Container Linux by CoreOS"] and inventory_hostname != groups['kube-master'][0] or download_delegate == "localhost") and download_run_once|bool and download.enabled|bool and download.container|bool diff --git a/roles/kubernetes/preinstall/tasks/main.yml b/roles/kubernetes/preinstall/tasks/main.yml index e79d92751..3ae785d6e 100644 --- a/roles/kubernetes/preinstall/tasks/main.yml +++ b/roles/kubernetes/preinstall/tasks/main.yml @@ -87,6 +87,10 @@ yum: update_cache: yes name: '*' + register: yum_task_result + until: yum_task_result|succeeded + retries: 4 + delay: "{{ retry_stagger | random + 3 }}" when: ansible_pkg_mgr == 'yum' and not is_atomic tags: bootstrap-os @@ -101,6 +105,10 @@ - name: Install python-dnf for latest RedHat versions command: dnf install -y python-dnf yum + register: dnf_task_result + until: dnf_task_result|succeeded + retries: 4 + delay: "{{ retry_stagger | random + 3 }}" when: ansible_distribution == "Fedora" and ansible_distribution_major_version > 21 changed_when: False @@ -109,6 +117,10 @@ - name: Install epel-release on RedHat/CentOS shell: rpm -qa | grep epel-release || rpm -ivh {{ epel_rpm_download_url }} when: ansible_distribution in ["CentOS","RedHat"] and not is_atomic + register: epel_task_result + until: epel_task_result|succeeded + retries: 4 + delay: "{{ retry_stagger | random + 3 }}" changed_when: False check_mode: no tags: bootstrap-os @@ -119,7 +131,7 @@ name: "{{ item }}" state: latest register: pkgs_task_result - until: pkgs_task_result|success + until: pkgs_task_result|succeeded retries: 4 delay: "{{ retry_stagger | random + 3 }}" with_items: "{{required_pkgs | default([]) | union(common_required_pkgs|default([]))}}" diff --git a/roles/rkt/tasks/install.yml b/roles/rkt/tasks/install.yml index 41823bf54..76719eebb 100644 --- a/roles/rkt/tasks/install.yml +++ b/roles/rkt/tasks/install.yml @@ -19,7 +19,7 @@ deb: "{{ rkt_download_url }}/{{ rkt_pkg_name }}" state: present register: rkt_task_result - until: rkt_task_result|success + until: rkt_task_result|succeeded retries: 4 delay: "{{ retry_stagger | random + 3 }}" when: ansible_os_family == "Debian" @@ -29,7 +29,7 @@ pkg: "{{ rkt_download_url }}/{{ rkt_pkg_name }}" state: present register: rkt_task_result - until: rkt_task_result|success + until: rkt_task_result|succeeded retries: 4 delay: "{{ retry_stagger | random + 3 }}" when: ansible_os_family == "RedHat"