Skip to content

Commit

Permalink
Use vault repositories for CentOS 7. (#54)
Browse files Browse the repository at this point in the history
The mirror.centos.org repos for CentOS 7 were recently removed.
  • Loading branch information
jeffmcutter authored Jul 3, 2024
1 parent 37ea0b2 commit a8fc9d8
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
5 changes: 5 additions & 0 deletions changelogs/fragments/use_vault_for_centos_7.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
minor_changes:
- Use vault repositories for CentOS 7.

...
10 changes: 10 additions & 0 deletions roles/common/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
---
# defaults file for common

common_centos7_repos:
- CentOS-Base.repo
- CentOS-CR.repo
- CentOS-Debuginfo.repo
- CentOS-fasttrack.repo
- CentOS-Media.repo
- CentOS-Sources.repo
- CentOS-Vault.repo
- CentOS-x86_64-kernel.repo

common_centos8_repos:
- CentOS-Linux-AppStream.repo
- CentOS-Linux-BaseOS.repo
Expand Down
18 changes: 18 additions & 0 deletions roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,24 @@
- ansible_distribution not in common_supported_distribution
- ansible_distribution_major_version in common_supported_major_version

- name: Patch repositories if dealing with CentOS 7.
block:
- name: Comment mirrorlist in all repos.
ansible.builtin.replace:
path: /etc/yum.repos.d/{{ item }}
regexp: ^mirrorlist
replace: "#mirrorlist"
loop: "{{ common_centos7_repos }}"
when: ansible_distribution == 'CentOS' and ansible_distribution_major_version | int == 7

- name: Switch repo to vault.centos.org.
ansible.builtin.replace:
path: /etc/yum.repos.d/{{ item }}
regexp: "#baseurl=http://mirror.centos.org"
replace: baseurl=https://vault.centos.org
loop: "{{ common_centos7_repos }}"
when: ansible_distribution == 'CentOS' and ansible_distribution_major_version | int == 7

- name: Patch repositories if dealing with CentOS 8.
block:
- name: Comment mirrorlist in all repos.
Expand Down

0 comments on commit a8fc9d8

Please sign in to comment.