-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdate-repo.yml
41 lines (35 loc) · 1.13 KB
/
update-repo.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Fetch VM inventory
- hosts: vm_hosts
become: True
tasks:
- include_role:
name: role-virt-host
tasks_from: inventory
- hosts: dnf_repo_updater
become: True
serial: 1
vars:
testrepos:
- /var/cache/dnf/
- /var/cache/libdnf5/
localrepo: /mnt/vmfs/rpm_repo/{{ ansible_distribution_major_version }}
tasks:
- name: repo tools
dnf: name="dnf-utils,createrepo_c" state=present
- name: Copy cache to repo
shell: rsync -vr --prune-empty-dirs --exclude "{{ dnf_repositories[dnf_staging_repo].name }}-*" -f "+ */" -f "+ *.rpm" -f "- *" {{ item }} {{ localrepo }}
with_items: "{{ testrepos }}"
- name: Update repo metadata
shell: createrepo -d --repo={{ dnf_repositories[dnf_staging_repo].name }} -c createrepo_cache .
args:
chdir: "{{ localrepo }}"
- name: Find old repo packages
shell: repomanage -o {{ localrepo }}
register: repomanage
- name: Purge old repo packages
file:
path: "{{ item }}"
state: absent
with_items: "{{ repomanage.stdout_lines }}"
- name: Clean staging cache
shell: dnf clean all