mirror of
https://gitlab.sectorq.eu/jaydee/ansible.git
synced 2026-03-13 21:52:21 +01:00
59 lines
1.5 KiB
YAML
59 lines
1.5 KiB
YAML
---
|
|
- name: Update Rocky 9 repos to local mirror
|
|
become: true
|
|
|
|
vars:
|
|
mirror_url: "http://192.168.77.101:8383/rocky/$releasever"
|
|
|
|
block:
|
|
- name: Facts
|
|
ansible.builtin.setup:
|
|
when: ansible_facts.architecture is not defined
|
|
|
|
|
|
# - name: Disable mirrorlist in baseos
|
|
# ansible.builtin.ini_file:
|
|
# path: /etc/yum.repos.d/rocky.repo
|
|
# section: baseos
|
|
# option: mirrorlist
|
|
# state: in
|
|
|
|
# - name: Set BaseOS baseurl
|
|
# ansible.builtin.ini_file:
|
|
# path: /etc/yum.repos.d/rocky.repo
|
|
# section: baseos
|
|
# option: baseurl
|
|
# value: "{{ mirror_url }}/baseos/"
|
|
- name: Comment mirrorlist in [baseos]
|
|
replace:
|
|
path: /etc/yum.repos.d/rocky.repo
|
|
regexp: '(^\[baseos\][^\[]*?)^mirrorlist=(.*)'
|
|
replace: '\1#mirrorlist=\2'
|
|
|
|
- name: Comment mirrorlist in [appstream]
|
|
replace:
|
|
path: /etc/yum.repos.d/rocky.repo
|
|
regexp: '(^\[appstream\][^\[]*?)^mirrorlist=(.*)'
|
|
replace: '\1#mirrorlist=\2'
|
|
|
|
- name: Set BaseOS baseurl
|
|
ansible.builtin.ini_file:
|
|
path: /etc/yum.repos.d/rocky.repo
|
|
section: baseos
|
|
option: baseurl
|
|
value: "{{ mirror_url }}/baseos/"
|
|
|
|
|
|
|
|
- name: Set AppStream baseurl
|
|
ansible.builtin.ini_file:
|
|
path: /etc/yum.repos.d/rocky.repo
|
|
section: appstream
|
|
option: baseurl
|
|
value: "{{ mirror_url }}/appstream/"
|
|
|
|
- name: Clean DNF cache
|
|
command: dnf clean all
|
|
|
|
- name: Rebuild cache
|
|
command: dnf makecache |