File tree Expand file tree Collapse file tree 1 file changed +18
-11
lines changed Expand file tree Collapse file tree 1 file changed +18
-11
lines changed Original file line number Diff line number Diff line change 8888 - (ansible_distribution_version | float) < 9
8989
9090# CentOS 7 EOL at July 1, 2024.
91- - name : Disable CentOS 7 mirrorlist in CentOS -Base.repo
92- replace :
91+ - name : Check CentOS-Base.repo exists for CentOS 7
92+ stat :
9393 path : /etc/yum.repos.d/CentOS-Base.repo
94- regexp : ' ^mirrorlist='
95- replace : ' #mirrorlist='
96- become : true
94+ register : centos_base_repo_stat
9795 when :
9896 - ansible_distribution_major_version == "7"
9997
10098# CentOS 7 EOL at July 1, 2024.
101- - name : Update CentOS 7 baseurl in CentOS-Base.repo
102- replace :
103- path : /etc/yum.repos.d/CentOS-Base.repo
104- regexp : ' ^#baseurl=http:\/\/mirror.centos.org'
105- replace : ' baseurl=http:\/\/vault.centos.org'
106- become : true
99+ - name : Update CentOS 7 CentOS-Base.repo
107100 when :
108101 - ansible_distribution_major_version == "7"
102+ - centos_base_repo_stat.stat.exists
103+ become : true
104+ block :
105+ - name : Disable CentOS 7 mirrorlist in CentOS-Base.repo
106+ replace :
107+ path : " {{ centos_base_repo_stat.stat.path }}"
108+ regexp : ' ^mirrorlist='
109+ replace : ' #mirrorlist='
110+
111+ - name : Update CentOS 7 baseurl in CentOS-Base.repo
112+ replace :
113+ path : " {{ centos_base_repo_stat.stat.path }}"
114+ regexp : ' ^#baseurl=http:\/\/mirror.centos.org'
115+ replace : ' baseurl=http:\/\/vault.centos.org'
109116
110117# CentOS ships with python installed
111118
You can’t perform that action at this time.
0 commit comments