Skip to content

Instantly share code, notes, and snippets.

@tbielawa
Last active February 23, 2017 18:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbielawa/6c0947572e0dc63581125233d69aed87 to your computer and use it in GitHub Desktop.
Save tbielawa/6c0947572e0dc63581125233d69aed87 to your computer and use it in GitHub Desktop.
Test rhel sub
From 656a25ed8a290b6634927de000455aab0956198e Mon Sep 17 00:00:00 2001
From: Tim Bielawa <tbielawa@redhat.com>
Date: Tue, 7 Feb 2017 08:28:13 -0800
Subject: [PATCH] Hacky work-around for rhel-subscribe
---
playbooks/byo/rhel_subscribe.yml | 28 +++++++++++++++++++++++++++-
roles/rhel_subscribe/meta/main.yml | 2 +-
roles/rhel_subscribe/tasks/main.yml | 4 ++--
3 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/playbooks/byo/rhel_subscribe.yml b/playbooks/byo/rhel_subscribe.yml
index 65c0b1c..daa71a6 100644
--- a/playbooks/byo/rhel_subscribe.yml
+++ b/playbooks/byo/rhel_subscribe.yml
@@ -1,7 +1,33 @@
---
-- include: ../common/openshift-cluster/std_include.yml
+- name: Create initial host groups for localhost
+ hosts: localhost
+ connection: local
+ become: no
+ gather_facts: no
tags:
- always
+ tasks:
+ - include_vars: openshift-cluster/cluster_hosts.yml
+ - name: Evaluate group l_oo_all_hosts
+ add_host:
+ name: "{{ item }}"
+ groups: l_oo_all_hosts
+ with_items: "{{ g_all_hosts | default([]) }}"
+ changed_when: no
+
+- name: Create initial host groups for all hosts
+ hosts: l_oo_all_hosts
+ gather_facts: no
+ tags:
+ - always
+ tasks:
+ - include_vars: openshift-cluster/cluster_hosts.yml
+ - set_fact:
+ openshift_deployment_type: "{{ deployment_type }}"
+
+# - include: ../common/openshift-cluster/std_include.yml
+# tags:
+# - always
- name: Subscribe hosts, update repos and update OS packages
hosts: l_oo_all_hosts
diff --git a/roles/rhel_subscribe/meta/main.yml b/roles/rhel_subscribe/meta/main.yml
index 0bbeadd..46b3b12 100644
--- a/roles/rhel_subscribe/meta/main.yml
+++ b/roles/rhel_subscribe/meta/main.yml
@@ -1,3 +1,3 @@
---
dependencies:
- - role: openshift_facts
+ # - role: openshift_facts
diff --git a/roles/rhel_subscribe/tasks/main.yml b/roles/rhel_subscribe/tasks/main.yml
index 28c3c70..89b614f 100644
--- a/roles/rhel_subscribe/tasks/main.yml
+++ b/roles/rhel_subscribe/tasks/main.yml
@@ -8,6 +8,7 @@
rhel_subscription_user: "{{ lookup('oo_option', 'rhel_subscription_user') | default(rhsub_user, True) | default(omit, True) }}"
rhel_subscription_pass: "{{ lookup('oo_option', 'rhel_subscription_pass') | default(rhsub_pass, True) | default(omit, True) }}"
rhel_subscription_server: "{{ lookup('oo_option', 'rhel_subscription_server') | default(rhsub_server) }}"
+ no_log: True
- fail:
msg: "This role is only supported for Red Hat hosts"
@@ -57,5 +58,4 @@
when: openshift_pool_id.stdout != ''
- include: enterprise.yml
- when: deployment_type in [ 'enterprise', 'atomic-enterprise', 'openshift-enterprise' ] and
- not openshift.common.is_atomic | bool
+ when: deployment_type in [ 'enterprise', 'atomic-enterprise', 'openshift-enterprise' ]
--
2.9.3
# IN YOUR INVENTORY FILE IN THE [OSEv3:vars] section:
rhsub_pool="Employee SKU*"
# Looks up an environment variable you must set in your shell "RHSUB_PASS"
rhsub_pass="{{ lookup('env','RHSUB_PASS') }}"
# Looks up an environment variable you must set in your shell "RHSUB_USER"
rhsub_user="{{ lookup('env','RHSUB_USER') }}"
@tbielawa
Copy link
Author

Apply that patch with:

curl https://gist.githubusercontent.com/tbielawa/6c0947572e0dc63581125233d69aed87/raw/271698c092d1efa0acf7f0c1fdc817a79ea9aa59/0001-Hacky-work-around-for-rhel-subscribe.patch | git am -

@tbielawa
Copy link
Author

And subscribe with

$ ansible-playbook -v -i ./hosts-local-reg ./playbooks/byo/rhel_subscribe.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment