From da92c7e215543c34294720c501771bf73233c9fa Mon Sep 17 00:00:00 2001
From: Kenichi Omichi <ken1ohmichi@gmail.com>
Date: Mon, 27 Sep 2021 08:47:35 -0700
Subject: [PATCH] Add proxy for subscription-manager (#8012)

If using proxy, it is necessary to configure it before running
"subscription-manager status" command.
This adds the step.
---
 roles/bootstrap-os/tasks/bootstrap-redhat.yml | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/roles/bootstrap-os/tasks/bootstrap-redhat.yml b/roles/bootstrap-os/tasks/bootstrap-redhat.yml
index c6bf43ba4..be13f0d88 100644
--- a/roles/bootstrap-os/tasks/bootstrap-redhat.yml
+++ b/roles/bootstrap-os/tasks/bootstrap-redhat.yml
@@ -16,6 +16,13 @@
   become: true
   when: not skip_http_proxy_on_os_packages
 
+- name: Add proxy to RHEL subscription-manager if http_proxy is defined
+  command: /sbin/subscription-manager config --server.proxy_hostname={{ http_proxy | regex_replace(':\\d+$') }} --server.proxy_port={{ http_proxy | regex_replace('^.*:') }}
+  become: true
+  when:
+    - not skip_http_proxy_on_os_packages
+    - http_proxy is defined
+
 - name: Check RHEL subscription-manager status
   command: /sbin/subscription-manager status
   register: rh_subscription_status
-- 
GitLab