Mirrormanager: restore the expire-old-repo manual playbook
Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
This commit is contained in:
parent
625e83f1c2
commit
303b531da7
4 changed files with 102 additions and 13 deletions
|
@ -15,24 +15,38 @@
|
|||
# Possible product: Fedora/EPEL/RHEL
|
||||
|
||||
- name: Expire old repo files
|
||||
hosts: mm-backend01.iad2.fedoraproject.org
|
||||
become_user: mirrormanager
|
||||
# hosts: os_control
|
||||
# Testing for now:
|
||||
hosts: os_control_stg
|
||||
user: root
|
||||
gather_facts: False
|
||||
|
||||
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/global.yml
|
||||
- "/srv/private/ansible/vars.yml"
|
||||
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
|
||||
- /srv/web/infra/ansible/vars/apps/mirrormanager.yml
|
||||
|
||||
vars:
|
||||
app: mirrormanager
|
||||
job_name: cmd-emergency-expire-repo-{{ product|lower|replace(" ", "-") }}-{{ version|lower|replace(" ", "-") }}
|
||||
|
||||
tasks:
|
||||
- name: Expire old files
|
||||
command: /usr/bin/mm2_emergency-expire-repo {{product}} {{version}}
|
||||
|
||||
- name: Recreate pickle
|
||||
command: /usr/bin/mm2_update-mirrorlist-server
|
||||
- name: Validate parameters
|
||||
assert:
|
||||
that:
|
||||
- product is defined
|
||||
- version is defined
|
||||
fail_msg: "You need to define product and version"
|
||||
|
||||
- name: Sync the pickle
|
||||
command: /usr/local/bin/sync_pkl_to_mirrorlists.sh
|
||||
- include_role:
|
||||
name: openshift/object
|
||||
vars:
|
||||
template: cmd-emergency-expire-repo.yml
|
||||
|
||||
handlers:
|
||||
- import_tasks: "{{ handlers_path }}/restart_services.yml"
|
||||
- debug:
|
||||
msg: "You can watch the logs with 'oc -n {{ app }} logs -f job/{{ job_name }}'"
|
||||
|
||||
- name: Wait for the command to complete
|
||||
shell: oc -n {{ app }} wait --for=condition=Complete job/{{ job_name }}
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
# Manual command
|
||||
---
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: {{ job_name }}
|
||||
spec:
|
||||
parallelism: 1
|
||||
completions: 1
|
||||
activeDeadlineSeconds: 1800
|
||||
backoffLimit: 3
|
||||
template:
|
||||
name: {{ job_name }}
|
||||
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:
|
||||
# Defaults to 80 columns, not very readable
|
||||
- name: COLUMNS
|
||||
value: "160"
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: "/etc/mirrormanager"
|
||||
readOnly: true
|
||||
- name: scripts
|
||||
mountPath: "/opt/scripts"
|
||||
readOnly: true
|
||||
- name: ssh-key
|
||||
mountPath: /etc/mirrormanager-ssh/ssh_mirrorlist_proxies.key
|
||||
subPath: ssh_mirrorlist_proxies.key
|
||||
readOnly: true
|
||||
- name: data
|
||||
mountPath: /data
|
||||
- name: var-lib
|
||||
mountPath: "/var/lib/mirrormanager"
|
||||
- name: logs
|
||||
mountPath: "/var/log/mirrormanager"
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: config
|
||||
- name: scripts
|
||||
configMap:
|
||||
name: scripts
|
||||
- name: ssh-key
|
||||
secret:
|
||||
secretName: ssh-mirrorlist-proxies-key
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: mirrorlist-cache
|
||||
- name: var-lib
|
||||
persistentVolumeClaim:
|
||||
claimName: data
|
||||
- name: logs
|
||||
persistentVolumeClaim:
|
||||
claimName: logs
|
||||
securityContext:
|
||||
supplementalGroups: [1001280000]
|
|
@ -48,3 +48,5 @@ 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) }}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
#!/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