You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fluo.apache.org by ct...@apache.org on 2019/12/06 22:20:06 UTC

[fluo-muchos] branch master updated: Added retries to epel and yum install (#301)

This is an automated email from the ASF dual-hosted git repository.

ctubbsii pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/fluo-muchos.git


The following commit(s) were added to refs/heads/master by this push:
     new 34b798c  Added retries to epel and yum install (#301)
34b798c is described below

commit 34b798cf2c1d39c3ba286d2c32e4870aa4b911e8
Author: Shan <sh...@users.noreply.github.com>
AuthorDate: Fri Dec 6 17:19:57 2019 -0500

    Added retries to epel and yum install (#301)
---
 ansible/roles/common/tasks/main.yml | 8 ++++++++
 ansible/scripts/install_ansible.sh  | 8 ++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/ansible/roles/common/tasks/main.yml b/ansible/roles/common/tasks/main.yml
index 39b97d3..49536cd 100644
--- a/ansible/roles/common/tasks/main.yml
+++ b/ansible/roles/common/tasks/main.yml
@@ -17,6 +17,10 @@
 
 - name: "enable epel yum repo"
   yum: name=epel-release state=present
+  register: epelresult
+  retries: 10
+  delay: 15
+  until: epelresult is not failed
 - name: "install packages"
   yum:
     name:
@@ -31,6 +35,10 @@
       - collectd-zookeeper
       - policycoreutils-python
     state: present
+  register: yumresult
+  retries: 10
+  delay: 15
+  until: yumresult is not failed
 - name: "configure node shutdown"
   shell: shutdown +{{ shutdown_delay_minutes }} &> {{ user_home }}/.shutdown creates={{ user_home }}/.shutdown
   when: shutdown_delay_minutes > 0
diff --git a/ansible/scripts/install_ansible.sh b/ansible/scripts/install_ansible.sh
index cc3ed62..1dbb7fb 100755
--- a/ansible/scripts/install_ansible.sh
+++ b/ansible/scripts/install_ansible.sh
@@ -23,10 +23,14 @@ base_dir=$( cd "$( dirname "$bin" )" && pwd )
 set -e
 
 # enable yum epel repo
-rpm -q --quiet epel-release || sudo yum install -q -y epel-release
+is_installed_epel_release="rpm -q --quiet epel-release"
+install_epel_release="sudo yum install -q -y epel-release"
+for i in {1..10}; do ($is_installed_epel_release || $install_epel_release) && break || sleep 15; done
 
 # install ansible
-rpm -q --quiet ansible || sudo yum install -q -y ansible
+is_installed_ansible="rpm -q --quiet ansible"
+install_ansible="sudo yum install -q -y ansible"
+for i in {1..10}; do ($is_installed_ansible || $install_ansible) && break || sleep 15; done
 
 # setup user-specific ansible configuration
 if [ ! -h ~/.ansible.cfg ]; then