From: David Galloway Date: Thu, 11 Aug 2016 20:57:50 +0000 (-0400) Subject: testnodes: Add support for internal RHEL beta repos X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=8a79ae97915b479a19a255d483dd5e779b1e3b0b;p=ceph-cm-ansible.git testnodes: Add support for internal RHEL beta repos Signed-off-by: David Galloway --- diff --git a/roles/common/README.rst b/roles/common/README.rst index e66b71b..71abad2 100644 --- a/roles/common/README.rst +++ b/roles/common/README.rst @@ -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``. diff --git a/roles/common/defaults/main.yml b/roles/common/defaults/main.yml index 26259f4..bf7cb07 100644 --- a/roles/common/defaults/main.yml +++ b/roles/common/defaults/main.yml @@ -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 index 0000000..f5e9174 --- /dev/null +++ b/roles/common/tasks/beta_repos.yml @@ -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 diff --git a/roles/common/tasks/yum_systems.yml b/roles/common/tasks/yum_systems.yml index a34579e..198691c 100644 --- a/roles/common/tasks/yum_systems.yml +++ b/roles/common/tasks/yum_systems.yml @@ -48,9 +48,27 @@ 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