From dfdf53072357335f849530490f39c247d35ff484 Mon Sep 17 00:00:00 2001
From: Anton Patsev <patsev.anton@gmail.com>
Date: Wed, 7 Nov 2018 12:44:37 +0600
Subject: [PATCH] Fix work yum in Install packages requirements for bootstrap
 (#3630)

* Fix Failure talking to yum: Cannot find a valid baseurl for repo: base/7/x86_64 if Install packages in CentOS using proxy

* Add proxy to /etc/yum.conf if http_proxy is defined
---
 roles/bootstrap-os/tasks/bootstrap-centos.yml | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/roles/bootstrap-os/tasks/bootstrap-centos.yml b/roles/bootstrap-os/tasks/bootstrap-centos.yml
index 07a555c14..142842b8e 100644
--- a/roles/bootstrap-os/tasks/bootstrap-centos.yml
+++ b/roles/bootstrap-os/tasks/bootstrap-centos.yml
@@ -14,6 +14,14 @@
     state: present
   when: fastestmirror.stat.exists
 
+- name: Add proxy to /etc/yum.conf if http_proxy is defined
+  lineinfile:
+    path: "/etc/yum.conf"
+    line: "proxy={{http_proxy}}"
+    create: yes
+    state: present
+  when: http_proxy is defined
+
 - name: Install packages requirements for bootstrap
   yum:
     name: "{{ packages }}"
@@ -27,4 +35,3 @@
   yum:
     name: python-pip
     state: present
-  environment: "{{proxy_env}}"
-- 
GitLab