ansible/playbooks/openshift-apps/mirrormanager.yml
Aurélien Bompard 4e209dc725
Mirrormanager: use the new rabbitmq cert
Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
2024-06-21 11:06:37 +02:00

176 lines
4.9 KiB
YAML

#
# MirrorManager
#
---
- name: setup the database
hosts: db01.iad2.fedoraproject.org:db01.stg.iad2.fedoraproject.org
gather_facts: no
become: yes
become_user: postgres
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
tasks:
- name: DB user
postgresql_user:
name: "{{ (env == 'production')|ternary(mirrormanager_db_user, mirrormanager_stg_db_user) }}"
password: "{{ (env == 'production')|ternary(mirrormanager_db_pass, mirrormanager_stg_db_pass) }}"
- name: FMN database creation
postgresql_db:
name: "{{ (env == 'production')|ternary(mirrormanager_db_name, mirrormanager_stg_db_name) }}"
owner: "{{ (env == 'production')|ternary(mirrormanager_db_user, mirrormanager_stg_db_user) }}"
encoding: UTF-8
- name: make the app be real
hosts: os_control_stg:os_control
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/apps/mirrormanager.yml
roles:
- role: rabbit/user
username: "mirrormanager{{ env_suffix }}"
sent_topics: ^org\.fedoraproject\.{{ env_short }}\.mirrormanager\..*
tags:
- config
- fedora-messaging
- rabbitmq_cluster
- role: openshift/project
app: mirrormanager
description: "MirrorManager"
appowners:
- abompard
- nphilipp
- adrian
tags:
- apply-appowners
- role: openshift/object
app: mirrormanager
file: imagestream.yml
objectname: imagestream.yml
- role: openshift/object
app: mirrormanager
template: buildconfig.yml
objectname: buildconfig.yml
- role: openshift/object
app: mirrormanager
file: storage.yml
objectname: storage.yml
- role: openshift/object
app: mirrormanager
template: secrets.yml
objectname: secrets.yml
- role: openshift/object
app: mirrormanager
template: configmap.yml
objectname: configmap.yml
- role: openshift/object
app: mirrormanager
file: service.yml
objectname: service.yml
# Routes
- role: openshift/route
app: mirrormanager
routename: frontend
host: "{{ mirrormanager_hostname }}"
servicename: frontend
serviceport: web
annotations:
haproxy.router.openshift.io/timeout: 5m
- role: openshift/route
app: mirrormanager
routename: frontend-openshift
host: "mirrormanager.apps.ocp{{ env_suffix }}.fedoraproject.org"
servicename: frontend
serviceport: web
annotations:
haproxy.router.openshift.io/timeout: 5m
when: mirrormanager_hostname != "mirrormanager.apps.ocp{}.fedoraproject.org".format(env_suffix)
# SSH key to get the access logs
- role: openshift/secret-file
app: mirrormanager
secret_name: ssh-mirrorlist-proxies-key
key: ssh_mirrorlist_proxies.key
privatefile: "mirrormanager/id_rsa"
# Fedora Messaging
- role: openshift/secret-file
app: mirrormanager
secret_name: fedora-messaging-ca
key: cacert.pem
privatefile: "rabbitmq/{{env}}/pki/ca.crt"
- role: openshift/secret-file
app: mirrormanager
secret_name: fedora-messaging-crt
key: cert.pem
privatefile: "rabbitmq/{{env}}/pki/issued/mirrormanager{{env_suffix}}.crt"
- role: openshift/secret-file
app: mirrormanager
secret_name: fedora-messaging-key
key: key.pem
privatefile: "rabbitmq/{{env}}/pki/private/mirrormanager{{env_suffix}}.key"
# Deployment config
- role: openshift/object
app: mirrormanager
template: deploymentconfig.yml
objectname: deploymentconfig.yml
# Cron jobs
- role: openshift/object
app: mirrormanager
template: cron-crawler.yml
objectname: cron-crawler.yml
- role: openshift/object
app: mirrormanager
template: cron-propagation.yml
objectname: cron-propagation.yml
- role: openshift/object
app: mirrormanager
template: cron-accesses.yml
objectname: cron-accesses.yml
- role: openshift/object
app: mirrormanager
template: cron-mirrorlist-cache.yml
objectname: cron-mirrorlist-cache.yml
- role: openshift/object
app: mirrormanager
template: cron-geoip.yml
objectname: cron-geoip.yml
- role: openshift/object
app: mirrormanager
template: cron-primary-mirror.yml
objectname: cron-primary-mirror.yml
- role: openshift/start-build
app: mirrormanager
buildname: mm
tags:
- never
- build
- role: openshift/rollout
app: mirrormanager
dcname: frontend
tags:
- never
- rollout