From 8ac328ec21826ee4610a30931a956717dae49ad3 Mon Sep 17 00:00:00 2001 From: David Moreau-Simard Date: Wed, 6 Sep 2017 22:35:42 -0400 Subject: [PATCH] Add support for centos in configure-mirrors Change-Id: Ia62c60fb9bd7e8e19d9349fa9675aa379b872924 --- roles/configure-mirrors/handlers/main.yaml | 7 +++++ .../tasks/mirror/CentOS.yaml | 13 +++++++++ .../etc/yum.repos.d/CentOS-Base.repo.j2 | 28 +++++++++++++++++++ .../templates/etc/yum.repos.d/epel.repo.j2 | 24 ++++++++++++++++ roles/configure-mirrors/vars/CentOS.yaml | 2 ++ zuul.yaml | 9 ++++++ 6 files changed, 83 insertions(+) create mode 100644 roles/configure-mirrors/tasks/mirror/CentOS.yaml create mode 100644 roles/configure-mirrors/templates/etc/yum.repos.d/CentOS-Base.repo.j2 create mode 100644 roles/configure-mirrors/templates/etc/yum.repos.d/epel.repo.j2 create mode 100644 roles/configure-mirrors/vars/CentOS.yaml diff --git a/roles/configure-mirrors/handlers/main.yaml b/roles/configure-mirrors/handlers/main.yaml index b41e15af5..8454af53e 100644 --- a/roles/configure-mirrors/handlers/main.yaml +++ b/roles/configure-mirrors/handlers/main.yaml @@ -3,3 +3,10 @@ - name: Update apt cache become: yes command: apt-get update + +- name: Update yum cache + become: yes + command: "{{ item }}" + with_items: + - yum clean all + - yum makecache diff --git a/roles/configure-mirrors/tasks/mirror/CentOS.yaml b/roles/configure-mirrors/tasks/mirror/CentOS.yaml new file mode 100644 index 000000000..441ce1ba6 --- /dev/null +++ b/roles/configure-mirrors/tasks/mirror/CentOS.yaml @@ -0,0 +1,13 @@ +- name: Install CentOS repository files + become: yes + template: + dest: "/{{ item }}" + group: root + mode: 0644 + owner: root + src: "{{ item }}.j2" + with_items: + - etc/yum.repos.d/CentOS-Base.repo + - etc/yum.repos.d/epel.repo + notify: + - Update yum cache diff --git a/roles/configure-mirrors/templates/etc/yum.repos.d/CentOS-Base.repo.j2 b/roles/configure-mirrors/templates/etc/yum.repos.d/CentOS-Base.repo.j2 new file mode 100644 index 000000000..94f9a6037 --- /dev/null +++ b/roles/configure-mirrors/templates/etc/yum.repos.d/CentOS-Base.repo.j2 @@ -0,0 +1,28 @@ +# {{ ansible_managed }} +[base] +name=CentOS-$releasever - Base +baseurl={{ package_mirror }}/$releasever/os/$basearch/ +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 + +#released updates +[updates] +name=CentOS-$releasever - Updates +baseurl={{ package_mirror }}/$releasever/updates/$basearch/ +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 + +#additional packages that may be useful +[extras] +name=CentOS-$releasever - Extras +baseurl={{ package_mirror }}/$releasever/extras/$basearch/ +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 + +#additional packages that extend functionality of existing packages +[centosplus] +name=CentOS-$releasever - Plus +baseurl={{ package_mirror }}/centos/$releasever/centosplus/$basearch/ +gpgcheck=1 +enabled=0 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 diff --git a/roles/configure-mirrors/templates/etc/yum.repos.d/epel.repo.j2 b/roles/configure-mirrors/templates/etc/yum.repos.d/epel.repo.j2 new file mode 100644 index 000000000..4c19390b3 --- /dev/null +++ b/roles/configure-mirrors/templates/etc/yum.repos.d/epel.repo.j2 @@ -0,0 +1,24 @@ +# {{ ansible_managed }} +[epel] +name=Extra Packages for Enterprise Linux 7 - $basearch +baseurl={{ epel_mirror }}/7/$basearch +failovermethod=priority +enabled=0 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 + +[epel-debuginfo] +name=Extra Packages for Enterprise Linux 7 - $basearch - Debug +baseurl={{ epel_mirror }}/7/$basearch/debug +failovermethod=priority +enabled=0 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 +gpgcheck=1 + +[epel-source] +name=Extra Packages for Enterprise Linux 7 - $basearch - Source +baseurl={{ epel_mirror }}/7/SRPMS +failovermethod=priority +enabled=0 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 +gpgcheck=1 diff --git a/roles/configure-mirrors/vars/CentOS.yaml b/roles/configure-mirrors/vars/CentOS.yaml new file mode 100644 index 000000000..23459bb8c --- /dev/null +++ b/roles/configure-mirrors/vars/CentOS.yaml @@ -0,0 +1,2 @@ +package_mirror: "http://{{ mirror_fqdn }}/{{ ansible_distribution | lower }}" +epel_mirror: "http://{{ mirror_fqdn }}/epel" \ No newline at end of file diff --git a/zuul.yaml b/zuul.yaml index fbcfd01ea..45b17ce6e 100644 --- a/zuul.yaml +++ b/zuul.yaml @@ -160,6 +160,13 @@ - zuul: openstack-infra/project-config run: playbooks/integration-tests/base +- job: + name: base-integration-centos-7 + parent: base-integration + nodes: + - name: centos-7 + label: centos-7 + - job: name: base-integration-ubuntu-trusty parent: base-integration @@ -178,9 +185,11 @@ name: openstack-infra/zuul-jobs check: jobs: + - base-integration-centos-7 - base-integration-ubuntu-trusty - base-integration-ubuntu-xenial gate: jobs: + - base-integration-centos-7 - base-integration-ubuntu-trusty - base-integration-ubuntu-xenial