Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use vault repositories for CentOS 7. #54

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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