Add a playbook to run move-to-archive
Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
This commit is contained in:
parent
6949a0ca71
commit
be05575049
4 changed files with 83 additions and 1 deletions
40
playbooks/manual/mirrormanager-move-to-archive.yml
Normal file
40
playbooks/manual/mirrormanager-move-to-archive.yml
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
# This playbook moves a distro version to the archive in MirrorManager's DB
|
||||||
|
|
||||||
|
# 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 archived.
|
||||||
|
|
||||||
|
- name: Run the move-to-archive script
|
||||||
|
hosts:
|
||||||
|
- os_masters[0]
|
||||||
|
- os_masters_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/object
|
||||||
|
app: mirrormanager
|
||||||
|
template: cmd-move-to-archive.yml
|
||||||
|
objectname: cmd-move-to-archive.yml
|
||||||
|
always_apply: true
|
|
@ -0,0 +1,41 @@
|
||||||
|
{% 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:
|
||||||
|
- "/opt/app-root/bin/mm2_move-to-archive
|
||||||
|
- "--product"
|
||||||
|
- "{{ product }}"
|
||||||
|
- "--version"
|
||||||
|
- "{{ version }}"
|
||||||
|
env:
|
||||||
|
{{ common_env() }}
|
||||||
|
volumeMounts:
|
||||||
|
{{ common_volume_mounts(with_ssh=True) }}
|
||||||
|
- name: mirror
|
||||||
|
mountPath: "/srv/pub"
|
||||||
|
- name: mirror-archive
|
||||||
|
mountPath: "/srv/pub/archive"
|
||||||
|
volumes:
|
||||||
|
{{ common_volumes(with_ssh=True) }}
|
||||||
|
- name: mirror
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: primary-mirror
|
||||||
|
- name: mirror-archive
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: primary-mirror-archive
|
||||||
|
{{ security_context() }}
|
|
@ -1 +1,2 @@
|
||||||
os_app: "{{app}}"
|
os_app: "{{app}}"
|
||||||
|
always_apply: false
|
||||||
|
|
|
@ -15,4 +15,4 @@
|
||||||
|
|
||||||
- name: Call `oc apply` on the copied file
|
- name: Call `oc apply` on the copied file
|
||||||
shell: oc -n {{os_app}} apply --validate=strict -f /etc/openshift_apps/{{os_app}}/{{objectname}}
|
shell: oc -n {{os_app}} apply --validate=strict -f /etc/openshift_apps/{{os_app}}/{{objectname}}
|
||||||
when: object_template.changed or object_template_fullpath.changed or object_file.changed
|
when: object_template.changed or object_template_fullpath.changed or object_file.changed or always_apply
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue