Ian Wienand 3eceba5749 reprepro: convert to Ansible
This converts the reprepro configuration from our existing puppet to
Ansible.

This takes a more direct approach; the templating done by the puppet
version started simple but over the years grew several different
options to handle various use-cases.  This means you not only had to
understand the rather obscure reprepro configuration, but then *also*
figure out how to translate that from our puppet template layers.

Here the configuration files are kept directly (they were copied from
the existing mirror-update.openstack.org) and deployed with some light
wrapper tasks in reprepro/tasks/utils which avoids most duplication.

Note the initial cron jobs are left disabled so we can run some manual
testing before letting it go automatically.

Change-Id: I96a9ff1efbf51c4164621028b7a3a1e2e1077d5c
2020-10-19 14:06:57 +11:00

34 lines
1.1 KiB
YAML

- name: Deploy Docker key
include_tasks: utils/keys.yaml
vars:
_keys:
- { key_id: '0EBFCD88', file: 'debian-docker.asc' }
# Unfortunately docker upstream doesn't do the pool model correctly,
# and we have to mirror each distro separately to avoid file
# conflicts (they have the same .deb files)
- name: Copy Debian Docker Xenial config
include_tasks: utils/copy-config.yaml
vars:
_dir: 'debian-docker-xenial'
- name: Copy Debian Docker Bionic
include_tasks: utils/copy-config.yaml
vars:
_dir: 'debian-docker-bionic'
- name: Copy Debian Docker Focal config
include_tasks: utils/copy-config.yaml
vars:
_dir: 'debian-docker-focal'
# Beacuse they all live on the same volume, run in order
- name: Install update cron jobs
cron:
name: 'Debian Docker reprepro mirror sync'
job: 'flock -n /var/run/reprepro/debian-docker.lock bash -c "for DISTRO in xenial bionic focal; do reprepro-mirror-update /etc/reprepro/debian-docker-\$DISTRO mirror.deb-docker >>/var/log/reprepro/debian-docker-\$DISTRO-mirror.log; done" 2>&1'
state: present
hour: '*/2'
minute: '{{ 45 | random(seed=inventory_hostname) }}'