MirrorManager: add a command to rebuild a repo

Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
This commit is contained in:
Aurélien Bompard 2024-08-06 07:51:15 +02:00
parent 5778e0d999
commit 15a3eb2658
No known key found for this signature in database
GPG key ID: 31584CFEB9BF64AD
4 changed files with 37 additions and 40 deletions

View file

@ -0,0 +1,37 @@
# This playbook forces an update of the mirrorlist cache in MirrorManager
# Usage:
# --extra-vars="product='EPEL' version='7'"
# product => The product name in MirrorManager's DB. Currently one of:
# "Fedora", "EPEL" or "RHEL"
# version => The version that must be expired and updated.
- name: Run the emergency-expire-repo script
hosts: os_control[0]:os_control_stg[0]
user: root
vars_files:
- /srv/web/infra/ansible/vars/global.yml
- /srv/private/ansible/vars.yml
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
- /srv/web/infra/ansible/vars/apps/mirrormanager.yml
handlers:
- import_tasks: "{{ handlers_path }}/restart_services.yml"
pre_tasks:
- name: Validate the product {{ product }}
assert:
that:
- product is defined
- product in ["Fedora", "EPEL", "RHEL"]
fail_msg: "The 'product' variable is not set correctly"
- name: Validate the version {{ version }}
assert:
that:
- version is defined
fail_msg: "The 'version' variable is not defined"
roles:
- role: openshift/job
app: mirrormanager
name: emergency-expire-repo-{{ product|lower|replace(" ", "-") }}-{{ version|lower|replace(" ", "-") }}
command: "/opt/app-root/bin/mm2_emergency-expire-repo {{ product }} {{ version }} && bash /opt/scripts/update-mirrorlist-cache.sh"