From 5b96d551628acb2fa6cbcb4ec4a0bde489084c3f Mon Sep 17 00:00:00 2001 From: Bo-Chun Louis Chen <louistw@uab.edu> Date: Mon, 8 Jul 2024 15:33:00 -0500 Subject: [PATCH] Use find since with_fileglob perform locally --- ansible/roles/fix_centos_repo/tasks/main.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ansible/roles/fix_centos_repo/tasks/main.yaml b/ansible/roles/fix_centos_repo/tasks/main.yaml index 07ac57b..983a86d 100644 --- a/ansible/roles/fix_centos_repo/tasks/main.yaml +++ b/ansible/roles/fix_centos_repo/tasks/main.yaml @@ -1,11 +1,15 @@ --- +- name: Get CentOS repo files + shell: ls /etc/yum.repos.d/CentOS-* + register: repo_files + - name: Remove mirrorlist from CentOS repo files ansible.builtin.replace: path: "{{ item }}" regexp: '^mirrorlist' replace: '#mirrorlist' backup: yes - with_fileglob: '/etc/yum.repos.d/CentOS-*.repo' + with_items: "{{ repo_files.stdout_lines }}" - name: Use vault baseurl to CentOS repo files ansible.builtin.replace: @@ -13,4 +17,4 @@ regexp: '^#baseurl=http://mirror.centos.org' replace: 'baseurl=http://vault.centos.org' backup: yes - with_fileglob: '/etc/yum.repos.d/CentOS-*.repo' + with_items: "{{ repo_files.stdout_lines }}" -- GitLab