summaryrefslogtreecommitdiffstats
path: root/roles/rhel_subscribe
diff options
context:
space:
mode:
authorLénaïc Huard <lhuard@amadeus.com>2015-06-05 17:44:33 +0200
committerLénaïc Huard <lhuard@amadeus.com>2015-07-17 14:31:34 +0200
commitfb4083bb920d193c2f292b49f370667029c317ba (patch)
treefd6af5ed5d884623acee3eb772cbfbb467a6e151 /roles/rhel_subscribe
parente0211ca67ce18fc9f74d0a9c82cf14a28f395e4d (diff)
downloadopenshift-fb4083bb920d193c2f292b49f370667029c317ba.tar.gz
openshift-fb4083bb920d193c2f292b49f370667029c317ba.tar.bz2
openshift-fb4083bb920d193c2f292b49f370667029c317ba.tar.xz
openshift-fb4083bb920d193c2f292b49f370667029c317ba.zip
Implement RHEL subscription for enterprise deployment type
Diffstat (limited to 'roles/rhel_subscribe')
-rw-r--r--roles/rhel_subscribe/tasks/enterprise.yml5
-rw-r--r--roles/rhel_subscribe/tasks/main.yml29
2 files changed, 34 insertions, 0 deletions
diff --git a/roles/rhel_subscribe/tasks/enterprise.yml b/roles/rhel_subscribe/tasks/enterprise.yml
new file mode 100644
index 000000000..fc4d44745
--- /dev/null
+++ b/roles/rhel_subscribe/tasks/enterprise.yml
@@ -0,0 +1,5 @@
+---
+- name: Enable RHEL repositories
+ command: subscription-manager repos \
+ --enable="rhel-7-server-rpms" \
+ --enable="rhel-7-server-ose-3.0-rpms"
diff --git a/roles/rhel_subscribe/tasks/main.yml b/roles/rhel_subscribe/tasks/main.yml
new file mode 100644
index 000000000..8fb2fc042
--- /dev/null
+++ b/roles/rhel_subscribe/tasks/main.yml
@@ -0,0 +1,29 @@
+---
+# TODO: Enhance redhat_subscription module
+# to make it able to attach to a pool
+# to make it able to enable repositories
+
+- set_fact:
+ 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) }}"
+
+- fail:
+ msg: "This role is only supported for Red Hat hosts"
+ when: ansible_distribution != 'RedHat'
+
+- fail:
+ msg: Either rsub_user or the rhel_subscription_user env variable are required for this role.
+ when: rhel_subscription_user is not defined
+
+- fail:
+ msg: Either rsub_pass or the rhel_subscription_pass env variable are required for this role.
+ when: rhel_subscription_pass is not defined
+
+- name: RedHat subscriptions
+ redhat_subscription:
+ username: "{{ rhel_subscription_user }}"
+ password: "{{ rhel_subscription_pass }}"
+ autosubscribe: yes
+
+- include: enterprise.yml
+ when: deployment_type == 'enterprise'