Skip to content
Snippets Groups Projects
Unverified Commit 86f98039 authored by Kay Yan's avatar Kay Yan Committed by GitHub
Browse files

Merge pull request #11402 from tu1h/fix_centos_baserepo

Check CentOS-Base.repo exists for CentOS 7
parents d469503e 351832ba
No related branches found
No related tags found
No related merge requests found
......@@ -88,24 +88,31 @@
- (ansible_distribution_version | float) < 9
# CentOS 7 EOL at July 1, 2024.
- name: Disable CentOS 7 mirrorlist in CentOS-Base.repo
replace:
- name: Check CentOS-Base.repo exists for CentOS 7
stat:
path: /etc/yum.repos.d/CentOS-Base.repo
regexp: '^mirrorlist='
replace: '#mirrorlist='
become: true
register: centos_base_repo_stat
when:
- ansible_distribution_major_version == "7"
# CentOS 7 EOL at July 1, 2024.
- name: Update CentOS 7 CentOS-Base.repo
when:
- ansible_distribution_major_version == "7"
- centos_base_repo_stat.stat.exists
become: true
block:
- name: Disable CentOS 7 mirrorlist in CentOS-Base.repo
replace:
path: "{{ centos_base_repo_stat.stat.path }}"
regexp: '^mirrorlist='
replace: '#mirrorlist='
- name: Update CentOS 7 baseurl in CentOS-Base.repo
replace:
path: /etc/yum.repos.d/CentOS-Base.repo
path: "{{ centos_base_repo_stat.stat.path }}"
regexp: '^#baseurl=http:\/\/mirror.centos.org'
replace: 'baseurl=http:\/\/vault.centos.org'
become: true
when:
- ansible_distribution_major_version == "7"
# CentOS ships with python installed
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment