From e0b76b185ab8efbc62794838b0bf077a9d2d7e15 Mon Sep 17 00:00:00 2001
From: dymq <damian.plata@wp.pl>
Date: Thu, 12 Mar 2020 23:08:39 +0100
Subject: [PATCH] Failover for adding proxy when line exists in file (#5751)

The 'regexp' parameter matches last occurrence of a line starting with 'proxy=' and replaces it with the one defined in 'line' parameter. If no match - it works same way as before. This fixes resuming cluster deployments failed after that task (if there was no more than one line starting with 'proxy' in the yum.conf file - this condition should also be reassured with the change introduced here) eg. if they were initiated with Terraform.
---
 roles/bootstrap-os/tasks/bootstrap-centos.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/roles/bootstrap-os/tasks/bootstrap-centos.yml b/roles/bootstrap-os/tasks/bootstrap-centos.yml
index 1b5224f34..3e74e0d37 100644
--- a/roles/bootstrap-os/tasks/bootstrap-centos.yml
+++ b/roles/bootstrap-os/tasks/bootstrap-centos.yml
@@ -30,6 +30,7 @@
 - name: Add proxy to /etc/yum.conf if http_proxy is defined
   lineinfile:
     path: "/etc/yum.conf"
+    regexp: "^proxy=.*$"
     line: "proxy={{ http_proxy }}"
     create: true
     state: present
-- 
GitLab