From: Dan Mick Date: Thu, 20 Apr 2023 20:26:12 +0000 (-0700) Subject: Remove "switch back from mirrorlist" code for CentOS X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=894d3b88c3126c05f6ab9c01c27da13c70a66af2;p=ceph-cm-ansible.git Remove "switch back from mirrorlist" code for CentOS The plan is to use mirrorlist exclusively (as we've done for EPEL) because the upstream infra is changing more rapidly than our fixed list of mirrors, and hopefully it's more stable than it was in the past when we were driven to this coping mechanism of caching mirror lists. Signed-off-by: Dan Mick --- diff --git a/roles/testnode/tasks/yum/baseurls_not_mirrorlists.yml b/roles/testnode/tasks/yum/baseurls_not_mirrorlists.yml deleted file mode 100644 index b458bf5..0000000 --- a/roles/testnode/tasks/yum/baseurls_not_mirrorlists.yml +++ /dev/null @@ -1,30 +0,0 @@ ---- -- name: dnf check-update to see if mirrorlists are working - command: dnf check-update - register: mirrorlist_check - ignore_errors: true - -# Default to false -- set_fact: - use_baseurls: false - -- set_fact: - use_baseurls: true - when: '"all mirrors were already tried" in mirrorlist_check.stderr' - -- name: Get list of repo files we need to use baseurls for - shell: "grep -l '^mirrorlist' *.repo | grep -v epel | cut -d '.' -f1" - args: - chdir: /etc/yum.repos.d - register: repo_files_with_mirrorlists - when: use_baseurls|bool - -- name: Comment mirrorlist parameter in each repo - shell: "sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/{{ item }}.repo" - with_items: "{{ repo_files_with_mirrorlists.stdout_lines }}" - when: use_baseurls|bool - -- name: Use a baseurl instead - shell: "echo 'baseurl=http://packages.oit.ncsu.edu/centos/{{ ansible_distribution_major_version }}{{ dash_stream }}/{% if item == \"CentOS-Extras\" %}extras{% else %}{{ item | regex_replace('CentOS-','') }}{% endif %}/{{ ansible_architecture }}/os/' >> /etc/yum.repos.d/{{ item }}.repo" - with_items: "{{ repo_files_with_mirrorlists.stdout_lines }}" - when: use_baseurls|bool diff --git a/roles/testnode/tasks/yum/repos.yml b/roles/testnode/tasks/yum/repos.yml index 7a99ada..278d8d7 100644 --- a/roles/testnode/tasks/yum/repos.yml +++ b/roles/testnode/tasks/yum/repos.yml @@ -31,11 +31,6 @@ with_dict: "{{ yum_repos|default({}) | combine(additional_yum_repos|default({}), recursive=True) }}" when: (yum_repos.keys() | length > 0) or (additional_yum_repos.keys() | length > 0) -# Occasionally when the yum repo mirrors get updated, we get 404s when using mirrorlist -# but not when using baseurls. No idea why. -- include_tasks: yum/baseurls_not_mirrorlists.yml - when: ansible_distribution == "CentOS" - - name: Enable copr repos command: "dnf -y copr enable {{ item }}" with_items: "{{ copr_repos }}"