]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
enable RHEL repositories from CDN
authorKen Dreyer <kdreyer@redhat.com>
Thu, 2 Apr 2015 18:54:00 +0000 (12:54 -0600)
committerKen Dreyer <kdreyer@redhat.com>
Mon, 6 Apr 2015 18:08:46 +0000 (12:08 -0600)
Note that the testnode role is creating the following .repo files
(that point to apt-mirror). With the Red Hat CDN, these are now
redundant:

  - rhel7-extras.repo
  - rhel7-optional.repo
  - rhel7.repo

These are harmless since they simply contain older versions of packages.
Yum will prefer the CDN repositories, since the packages there are
newer. Eventually we should figure out a way to remove these, though.

roles/common/defaults/main.yml [new file with mode: 0644]
roles/common/tasks/rhel-entitlements.yml

diff --git a/roles/common/defaults/main.yml b/roles/common/defaults/main.yml
new file mode 100644 (file)
index 0000000..f83370e
--- /dev/null
@@ -0,0 +1,5 @@
+# Repos to enable in Red Hat Subscription Manager
+rhsm_repos:
+  - rhel-7-server-rpms
+  - rhel-7-server-optional-rpms
+  - rhel-7-server-extras-rpms
index 7a8a756eab8e0b89ea22b94d6eafe30ad3e7bf3b..b3ee9e2d37e984b0996c10c321b7b88a6d86e3ef 100644 (file)
            --org={{ subscription_manager_org }}
   no_log: true
   when: subscription.rc != 0
+  register: entitled
+
+- name: disable all rhsm repos
+  command: subscription-manager repos --disable '*'
+  when: entitled|changed
+
+- name: enable necessary rhsm repos
+  command: subscription-manager repos --enable {{ item }}
+  with_items: rhsm_repos
+  when: entitled|changed and rhsm_repos|length > 0
+
+- name: Remove old apt-mirror repository definition.
+  file:
+    path: /etc/yum.repos.d/cd.repo
+    state: absent
+  when: entitled|success