Skip to content

Commit a8fc9d8

Browse files
authored
Use vault repositories for CentOS 7. (#54)
The mirror.centos.org repos for CentOS 7 were recently removed.
1 parent 37ea0b2 commit a8fc9d8

3 files changed

Lines changed: 33 additions & 0 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
minor_changes:
3+
- Use vault repositories for CentOS 7.
4+
5+
...

roles/common/defaults/main.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
---
22
# defaults file for common
33

4+
common_centos7_repos:
5+
- CentOS-Base.repo
6+
- CentOS-CR.repo
7+
- CentOS-Debuginfo.repo
8+
- CentOS-fasttrack.repo
9+
- CentOS-Media.repo
10+
- CentOS-Sources.repo
11+
- CentOS-Vault.repo
12+
- CentOS-x86_64-kernel.repo
13+
414
common_centos8_repos:
515
- CentOS-Linux-AppStream.repo
616
- CentOS-Linux-BaseOS.repo

roles/common/tasks/main.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,24 @@
77
- ansible_distribution not in common_supported_distribution
88
- ansible_distribution_major_version in common_supported_major_version
99

10+
- name: Patch repositories if dealing with CentOS 7.
11+
block:
12+
- name: Comment mirrorlist in all repos.
13+
ansible.builtin.replace:
14+
path: /etc/yum.repos.d/{{ item }}
15+
regexp: ^mirrorlist
16+
replace: "#mirrorlist"
17+
loop: "{{ common_centos7_repos }}"
18+
when: ansible_distribution == 'CentOS' and ansible_distribution_major_version | int == 7
19+
20+
- name: Switch repo to vault.centos.org.
21+
ansible.builtin.replace:
22+
path: /etc/yum.repos.d/{{ item }}
23+
regexp: "#baseurl=http://mirror.centos.org"
24+
replace: baseurl=https://vault.centos.org
25+
loop: "{{ common_centos7_repos }}"
26+
when: ansible_distribution == 'CentOS' and ansible_distribution_major_version | int == 7
27+
1028
- name: Patch repositories if dealing with CentOS 8.
1129
block:
1230
- name: Comment mirrorlist in all repos.

0 commit comments

Comments
 (0)