MirrorManager: add a command to rebuild a repo
Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
This commit is contained in:
parent
5778e0d999
commit
15a3eb2658
4 changed files with 37 additions and 40 deletions
37
playbooks/manual/mirrormanager/emergency-expire-repo.yml
Normal file
37
playbooks/manual/mirrormanager/emergency-expire-repo.yml
Normal 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"
|
|
@ -1,30 +0,0 @@
|
|||
{% from "_macros.yml" import common_volume_mounts, common_volumes, common_env, security_context with context %}
|
||||
# Manual command
|
||||
---
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: {{ job_name }}
|
||||
spec:
|
||||
parallelism: 1
|
||||
completions: 1
|
||||
activeDeadlineSeconds: 1800
|
||||
backoffLimit: 3
|
||||
template:
|
||||
spec:
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: mirrormanager
|
||||
image: image-registry.openshift-image-registry.svc:5000/mirrormanager/mirrormanager2:latest
|
||||
command:
|
||||
- "bash"
|
||||
- "/opt/scripts/emergency-expire-repo.sh"
|
||||
- "{{ product }}"
|
||||
- "{{ version }}"
|
||||
env:
|
||||
{{ common_env() }}
|
||||
volumeMounts:
|
||||
{{ common_volume_mounts(with_ssh=True) }}
|
||||
volumes:
|
||||
{{ common_volumes(with_ssh=True) }}
|
||||
{{ security_context() }}
|
|
@ -50,5 +50,3 @@ items:
|
|||
{{ load_file('update-mirrorlist-cache.sh') | indent(6) }}
|
||||
primary-mirror-wrapper.sh: |-
|
||||
{{ load_file('primary-mirror-wrapper.sh') | indent(6) }}
|
||||
emergency-expire-repo.sh: |-
|
||||
{{ load_file('emergency-expire-repo.sh') | indent(6) }}
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
MM_ROOT=/opt/app-root
|
||||
|
||||
set -e
|
||||
|
||||
${MM_ROOT}/bin/mm2_emergency-expire-repo $@
|
||||
bash /opt/scripts/update-mirrorlist-cache.sh
|
Loading…
Add table
Add a link
Reference in a new issue