Skip to content

Commit

Permalink
[PLAT-14546] Ansible task to replace CentOS 7 repo URLs
Browse files Browse the repository at this point in the history
Summary: With the EOL of CentOS 7 there are certain mirror URLs that are now invalid. We can replace these with the vault version (and comment out the mirrorlists) to temporarily unblock CentOS 7 universe creation.

Test Plan: Create universe on CentOS 7 gcp, ensure yum installs can complete.

Reviewers: sanketh, anijhawan, svarshney

Reviewed By: anijhawan

Subscribers: yugaware

Differential Revision: https://phorge.dev.yugabyte.com/D36453
  • Loading branch information
mchiddy committed Jul 13, 2024
1 parent cba0254 commit 6e99ea0
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
22 changes: 22 additions & 0 deletions managed/devops/preprovision.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,28 @@
when: cloud_type == "gcp" and machine_image is match(".*centos-7.*")
tags: yb-prebuilt-ami

- block:
- name: Find CentOS repo files
find:
paths: /etc/yum.repos.d/
patterns: 'CentOS-*'
register: repo_files

- name: Comment out mirrorlist URLs on CentOS 7
replace:
dest: "{{ item }}"
regexp: '^mirrorlist='
replace: '#mirrorlist='
with_items: "{{ repo_files.files | map(attribute='path') | list }}"

- name: Uncomment and set baseurl to vault in CentOS 7 repo files
replace:
dest: "{{ item }}"
regexp: '^#?baseurl=http://mirror.centos.org'
replace: 'baseurl=http://vault.centos.org'
with_items: "{{ repo_files.files | map(attribute='path') | list }}"
when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '7'

- name: Gather package facts
package_facts:
tags: yb-prebuilt-ami
Expand Down
26 changes: 26 additions & 0 deletions managed/devops/roles/server_base/tasks/server_base_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,32 @@

when: ansible_os_family == "RedHat" and (cloud_type is not defined or cloud_type != "onprem")

- block:
- name: Find CentOS repo files
find:
paths: /etc/yum.repos.d/
patterns: 'CentOS-*'
register: repo_files

- name: Comment out mirrorlist URLs on CentOS 7
become: yes
become_method: sudo
replace:
dest: "{{ item }}"
regexp: '^mirrorlist='
replace: '#mirrorlist='
with_items: "{{ repo_files.files | map(attribute='path') | list }}"

- name: Uncomment and set baseurl to vault in CentOS 7 repo files
become: yes
become_method: sudo
replace:
dest: "{{ item }}"
regexp: '^#?baseurl=http://mirror.centos.org'
replace: 'baseurl=http://vault.centos.org'
with_items: "{{ repo_files.files | map(attribute='path') | list }}"
when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '7'

- name: Gather package facts
package_facts:

Expand Down

0 comments on commit 6e99ea0

Please sign in to comment.