From fb4083bb920d193c2f292b49f370667029c317ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9na=C3=AFc=20Huard?= Date: Fri, 5 Jun 2015 17:44:33 +0200 Subject: Implement RHEL subscription for enterprise deployment type --- roles/rhel_subscribe/tasks/enterprise.yml | 5 +++++ roles/rhel_subscribe/tasks/main.yml | 29 +++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 roles/rhel_subscribe/tasks/enterprise.yml create mode 100644 roles/rhel_subscribe/tasks/main.yml (limited to 'roles/rhel_subscribe/tasks') 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' -- cgit v1.2.3 From 8e04a1650d54afb813f9b48b9deaa76b1aab3903 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pep=20Turr=C3=B3=20Mauri?= Date: Sun, 2 Aug 2015 14:06:02 +0200 Subject: Fine tune RHEL repos Disable all repos before explicitly enabling the expected ones: sometimes active repos might be polluted (e.g. depending on the result of rhsm auto-attach). Enable Extras and Optional repos. --- roles/rhel_subscribe/tasks/enterprise.yml | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'roles/rhel_subscribe/tasks') diff --git a/roles/rhel_subscribe/tasks/enterprise.yml b/roles/rhel_subscribe/tasks/enterprise.yml index fc4d44745..26ca5d807 100644 --- a/roles/rhel_subscribe/tasks/enterprise.yml +++ b/roles/rhel_subscribe/tasks/enterprise.yml @@ -1,5 +1,10 @@ --- +- name: Disable all repositories + command: subscription-manager repos --disable="*" + - name: Enable RHEL repositories command: subscription-manager repos \ --enable="rhel-7-server-rpms" \ + --enable="rhel-7-server-extras-rpms" \ + --enable="rhel-7-server-optional-rpms" \ --enable="rhel-7-server-ose-3.0-rpms" -- cgit v1.2.3 From b85398688f1f34721826da61e56d84a05269cfb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pep=20Turr=C3=B3=20Mauri?= Date: Wed, 12 Aug 2015 15:15:47 +0100 Subject: Remove the 'optional' repository --- roles/rhel_subscribe/tasks/enterprise.yml | 1 - 1 file changed, 1 deletion(-) (limited to 'roles/rhel_subscribe/tasks') diff --git a/roles/rhel_subscribe/tasks/enterprise.yml b/roles/rhel_subscribe/tasks/enterprise.yml index 26ca5d807..e9e6e4bd4 100644 --- a/roles/rhel_subscribe/tasks/enterprise.yml +++ b/roles/rhel_subscribe/tasks/enterprise.yml @@ -6,5 +6,4 @@ command: subscription-manager repos \ --enable="rhel-7-server-rpms" \ --enable="rhel-7-server-extras-rpms" \ - --enable="rhel-7-server-optional-rpms" \ --enable="rhel-7-server-ose-3.0-rpms" -- cgit v1.2.3