This commit is contained in:
2026-02-25 21:27:19 +01:00
parent 50cb7d2525
commit e9e6b1b08d
8 changed files with 124 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
---
- name: Update Rocky 9 repos to local mirror
hosts: rocky
become: yes
vars:
mirror_url: "http://192.168.77.101:8383/rocky/{{ ansible_distribution_major_version }}"
tasks:
- name: Disable mirrorlist
replace:
path: /etc/yum.repos.d/rocky.repo
regexp: '^mirrorlist='
replace: '#mirrorlist='
- name: Set BaseOS baseurl
replace:
path: /etc/yum.repos.d/rocky.repo
regexp: '^#?baseurl=.*BaseOS.*'
replace: "baseurl={{ mirror_url }}/baseos/"
- name: Set AppStream baseurl
replace:
path: /etc/yum.repos.d/rocky.repo
regexp: '^#?baseurl=.*AppStream.*'
replace: "baseurl={{ mirror_url }}/appstream/"
- name: Clean DNF cache
command: dnf clean all
- name: Rebuild cache
command: dnf makecache