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 88
88
- (ansible_distribution_version | float) < 9
89
89
90
90
# 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 :
93
93
path : /etc/yum.repos.d/CentOS-Base.repo
94
- regexp : ' ^mirrorlist='
95
- replace : ' #mirrorlist='
96
- become : true
94
+ register : centos_base_repo_stat
97
95
when :
98
96
- ansible_distribution_major_version == "7"
99
97
100
98
# 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
107
100
when :
108
101
- 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'
109
116
110
117
# CentOS ships with python installed
111
118
You can’t perform that action at this time.
0 commit comments