Bug fix for the random failure of pip_install 17/49117/1
authorYifei Xue <xueyifei@huawei.com>
Sat, 16 Dec 2017 06:45:00 +0000 (14:45 +0800)
committerYifei Xue <xueyifei@huawei.com>
Sat, 16 Dec 2017 06:45:00 +0000 (14:45 +0800)
JIAR: -

For centos deployment, it sometimes fails when
run the role: pip_install due to the network
is not so stable. So we add some retyies here
to avoid the failure.

Change-Id: I9774e5be4d42a66f8cf377ec83161b200266d3d0
Signed-off-by: Yifei Xue <xueyifei@huawei.com>
deploy/adapters/ansible/roles/config-osa/tasks/main.yml

index 046b25e..ac4ce41 100755 (executable)
              /etc/yum.repos.d/CentOS-Base.repo.bak;
   when: hostvars[hostvars[inventory_hostname]['groups']['controller'][0]]['local_mirror'] == 'CentOS'
 
+- name: fix the problem in pip_install
+  blockinfile:
+    dest: /etc/ansible/roles/pip_install/tasks/pre_install_yum.yml
+    insertafter: 'pip_install_package_state'
+    block: |
+      # add retry
+        register: repo_result
+        until: repo_result | success
+        retries: 5
+        delay: 10
+  when: hostvars[hostvars[inventory_hostname]['groups']['controller'][0]]['local_mirror'] == 'CentOS'
+
 - name: add mariadb local repository
   blockinfile:
     dest: /etc/openstack_deploy/user_variables.yml