Merge pull request #1149 from mattymo/centos-retries

Retry yum/apt/rpm download commands
This commit is contained in:
Matthew Mosesohn 2017-03-18 11:12:36 +03:00 committed by GitHub
commit 182a2e682f
4 changed files with 19 additions and 7 deletions

View file

@ -34,7 +34,7 @@
keyserver: "{{docker_repo_key_info.keyserver}}" keyserver: "{{docker_repo_key_info.keyserver}}"
state: present state: present
register: keyserver_task_result register: keyserver_task_result
until: keyserver_task_result|success until: keyserver_task_result|succeeded
retries: 4 retries: 4
delay: "{{ retry_stagger | random + 3 }}" delay: "{{ retry_stagger | random + 3 }}"
with_items: "{{ docker_repo_key_info.repo_keys }}" with_items: "{{ docker_repo_key_info.repo_keys }}"
@ -61,7 +61,7 @@
force: "{{item.force|default(omit)}}" force: "{{item.force|default(omit)}}"
state: present state: present
register: docker_task_result register: docker_task_result
until: docker_task_result|success until: docker_task_result|succeeded
retries: 4 retries: 4
delay: "{{ retry_stagger | random + 3 }}" delay: "{{ retry_stagger | random + 3 }}"
with_items: "{{ docker_package_info.pkgs }}" with_items: "{{ docker_package_info.pkgs }}"

View file

@ -92,7 +92,7 @@
- name: Download containers if pull is required or told to always pull - name: Download containers if pull is required or told to always pull
command: "{{ docker_bin_dir }}/docker pull {{ pull_args }}" command: "{{ docker_bin_dir }}/docker pull {{ pull_args }}"
register: pull_task_result register: pull_task_result
until: pull_task_result|success until: pull_task_result|succeeded
retries: 4 retries: 4
delay: "{{ retry_stagger | random + 3 }}" delay: "{{ retry_stagger | random + 3 }}"
when: "{{ download.enabled|bool and download.container|bool and pull_required|bool|default(download_always_pull) }}" when: "{{ download.enabled|bool and download.container|bool and pull_required|bool|default(download_always_pull) }}"
@ -150,7 +150,7 @@
delegate_to: localhost delegate_to: localhost
become: false become: false
register: get_task register: get_task
until: get_task|success until: get_task|succeeded
retries: 4 retries: 4
delay: "{{ retry_stagger | random + 3 }}" 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 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

View file

@ -87,6 +87,10 @@
yum: yum:
update_cache: yes update_cache: yes
name: '*' 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 when: ansible_pkg_mgr == 'yum' and not is_atomic
tags: bootstrap-os tags: bootstrap-os
@ -101,6 +105,10 @@
- name: Install python-dnf for latest RedHat versions - name: Install python-dnf for latest RedHat versions
command: dnf install -y python-dnf yum 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 when: ansible_distribution == "Fedora" and
ansible_distribution_major_version > 21 ansible_distribution_major_version > 21
changed_when: False changed_when: False
@ -109,6 +117,10 @@
- name: Install epel-release on RedHat/CentOS - name: Install epel-release on RedHat/CentOS
shell: rpm -qa | grep epel-release || rpm -ivh {{ epel_rpm_download_url }} shell: rpm -qa | grep epel-release || rpm -ivh {{ epel_rpm_download_url }}
when: ansible_distribution in ["CentOS","RedHat"] and not is_atomic 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 changed_when: False
check_mode: no check_mode: no
tags: bootstrap-os tags: bootstrap-os
@ -119,7 +131,7 @@
name: "{{ item }}" name: "{{ item }}"
state: latest state: latest
register: pkgs_task_result register: pkgs_task_result
until: pkgs_task_result|success until: pkgs_task_result|succeeded
retries: 4 retries: 4
delay: "{{ retry_stagger | random + 3 }}" delay: "{{ retry_stagger | random + 3 }}"
with_items: "{{required_pkgs | default([]) | union(common_required_pkgs|default([]))}}" with_items: "{{required_pkgs | default([]) | union(common_required_pkgs|default([]))}}"

View file

@ -19,7 +19,7 @@
deb: "{{ rkt_download_url }}/{{ rkt_pkg_name }}" deb: "{{ rkt_download_url }}/{{ rkt_pkg_name }}"
state: present state: present
register: rkt_task_result register: rkt_task_result
until: rkt_task_result|success until: rkt_task_result|succeeded
retries: 4 retries: 4
delay: "{{ retry_stagger | random + 3 }}" delay: "{{ retry_stagger | random + 3 }}"
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
@ -29,7 +29,7 @@
pkg: "{{ rkt_download_url }}/{{ rkt_pkg_name }}" pkg: "{{ rkt_download_url }}/{{ rkt_pkg_name }}"
state: present state: present
register: rkt_task_result register: rkt_task_result
until: rkt_task_result|success until: rkt_task_result|succeeded
retries: 4 retries: 4
delay: "{{ retry_stagger | random + 3 }}" delay: "{{ retry_stagger | random + 3 }}"
when: ansible_os_family == "RedHat" when: ansible_os_family == "RedHat"