]> git.apps.os.sepia.ceph.com Git - ceph-cm-ansible.git/commitdiff
testnodes: Add support for internal RHEL beta repos
authorDavid Galloway <dgallowa@redhat.com>
Thu, 11 Aug 2016 20:57:50 +0000 (16:57 -0400)
committerDavid Galloway <dgallowa@redhat.com>
Thu, 11 Aug 2016 21:32:18 +0000 (17:32 -0400)
Signed-off-by: David Galloway <dgallowa@redhat.com>
roles/common/README.rst
roles/common/defaults/main.yml
roles/common/tasks/beta_repos.yml [new file with mode: 0644]
roles/common/tasks/yum_systems.yml

index e66b71b44e0d22f3513759628525a80d4d553f0c..71abad22a1a01966ed21acd6bf3407ec2fd6a2f7 100644 (file)
@@ -43,6 +43,8 @@ your own local epel mirror.
 ``enable_epel`` is a boolean that sets whether epel repos should be enabled.
 Defined in ``roles/common/defaults/main.yml``.
 
+``beta_repos`` is a dict of internal Red Hat beta repos used to create repo files in /etc/yum.repos.d.  We have these defined in the secrets repo.  See ``epel_repos`` for dict syntax.
+
 ``yum_timeout`` is an integer used to set the yum timeout.  Defined in
 ``roles/common/defaults/main.yml``.
 
index 26259f450c338c478793ee9cb255fc7be3153a68..bf7cb077298a68b17ad37ceef62b7879c5c80460 100644 (file)
@@ -28,5 +28,12 @@ epel_repos:
     enabled: 0
     gpgcheck: 0
 
+# Override in secrets repo
+beta_repos: []
+
+# Default to false.  A task in roles/common/tasks/yum_systems.yml
+# will set this to true if lsb_release indicates the distro is an Alpha/Beta release
+beta_distro: false
+
 enable_epel: true
 yum_timeout: 300
diff --git a/roles/common/tasks/beta_repos.yml b/roles/common/tasks/beta_repos.yml
new file mode 100644 (file)
index 0000000..f5e9174
--- /dev/null
@@ -0,0 +1,15 @@
+---
+- name: Configure internal beta repos in /etc/yum.repos.d/
+  template:
+    src: yum_repo.j2
+    dest: /etc/yum.repos.d/{{ item.key }}.repo
+    owner: root
+    group: root
+    mode: 0644
+  register: beta_repo
+  with_dict: "{{ beta_repos }}"
+  no_log: true
+
+- name: Clean yum cache
+  shell: yum clean all
+  when: beta_repo is defined and beta_repo|changed
index a34579e3e8e18153291fc64b01711b1b5cf95154..198691cd5684fd933feaaa471018ef35a1290b85 100644 (file)
     state: present
   when: ansible_distribution == 'Fedora' and ansible_distribution_major_version|int >= 22
 
+- name: Determine if distro is a Beta or Alpha release
+  set_fact:
+    beta_distro: true
+  when:
+    ansible_distribution == 'RedHat' and
+    ('Beta' in ansible_lsb.description or
+     'Alpha' in ansible_lsb.description)
+
+# include internal repos when distro is a Beta or Alpha release
+- include: beta_repos.yml
+  when:
+    ansible_distribution == 'RedHat' and
+    beta_distro == true
+  tags:
+    - repos
+
 # configure Red Hat entitlements with subscription-manager
 - include: rhel-entitlements.yml
-  when: ansible_distribution == 'RedHat'
+  when:
+    ansible_distribution == 'RedHat' and
+    beta_distro == false
   tags:
     - entitlements