From 783871a2539392a5cd0cb0deb93c05ca8a502252 Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Tue, 13 Sep 2016 15:29:22 +0200 Subject: [PATCH] Add retries for packages installation Signed-off-by: Bogdan Dobrelya --- roles/docker/tasks/main.yml | 8 ++++++++ roles/kubernetes/preinstall/tasks/main.yml | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index 6d71c4980..826e16978 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -27,6 +27,10 @@ id: "{{item}}" keyserver: "{{docker_repo_key_info.keyserver}}" state: present + register: keyserver_task_result + until: keyserver_task_result|success + retries: 4 + delay: "{{ 20 | random + 3 }}" with_items: "{{ docker_repo_key_info.repo_keys }}" when: ansible_os_family != "CoreOS" @@ -51,6 +55,10 @@ pkg: "{{item.name}}" force: "{{item.force|default(omit)}}" state: present + register: docker_task_result + until: docker_task_result|success + retries: 4 + delay: "{{ 20 | random + 3 }}" with_items: "{{ docker_package_info.pkgs }}" when: (ansible_os_family != "CoreOS") and (docker_package_info.pkgs|length > 0) diff --git a/roles/kubernetes/preinstall/tasks/main.yml b/roles/kubernetes/preinstall/tasks/main.yml index ec1bd64c0..8c22b73bf 100644 --- a/roles/kubernetes/preinstall/tasks/main.yml +++ b/roles/kubernetes/preinstall/tasks/main.yml @@ -101,6 +101,10 @@ module: "{{ ansible_pkg_mgr }}" name: "{{ item }}" state: latest + register: pkgs_task_result + until: pkgs_task_result|success + retries: 4 + delay: "{{ 20 | random + 3 }}" with_items: "{{required_pkgs | default([]) | union(common_required_pkgs|default([]))}}" when: ansible_os_family != "CoreOS"