mirror of
https://gitlab.sectorq.eu/jaydee/ansible.git
synced 2026-03-13 05:42:46 +01:00
33 lines
825 B
YAML
33 lines
825 B
YAML
---
|
|
- 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 |