system-config/playbooks/roles/mirror-update/tasks/rsync.yaml
Ian Wienand 339cbf4c3d mirror-update: stats for vos release of mirrors
It's difficult to know if a release process is running too long when
we don't have a history of how long it should run for.

This is mostly the stats function from run_all.sh that has been
sending stats about runtimes there.  Wrap it in a vos_release function
with some minor refactoring, and update the scripts.

As noted inline, there's already release timer stats going to
afs.release.<volume> for the periodic release of docs/tarballs etc.

Change-Id: I3d79d1a0997af8977050b7f6e7cf3b7578cc8491
2020-04-09 14:34:35 +10:00

80 lines
1.8 KiB
YAML

# Mirror scripts that use rsync
- name: Create rsync log output directory
file:
path: /var/log/rsync-mirrors
state: directory
owner: root
group: root
mode: '0755'
- name: Create common function dir
file:
path: /usr/share/mirror-update
state: directory
owner: root
group: root
mode: '0755'
- name: Copy in common functions
copy:
src: 'functions.sh'
dest: '/usr/share/mirror-update'
owner: root
group: root
mode: '0644'
- name: Set update script names
set_fact:
rsync_update_scripts:
- centos
- epel
- fedora
- opensuse
- yum-puppetlabs
- name: Copy keytab files in place
shell: 'echo "{{ lookup("vars", "mirror_update_keytab_" + item) }}" | base64 -d > /etc/{{ item }}.keytab'
args:
creates: '/etc/{{ item }}.keytab'
loop: '{{ rsync_update_scripts }}'
no_log: True
- name: Ensure keytab permissions
file:
path: '/etc/{{ item }}.keytab'
owner: root
group: root
mode: '0400'
loop: '{{ rsync_update_scripts }}'
- name: Copy rsync mirror scripts in place
copy:
src: '{{ item }}-mirror-update'
dest: '/usr/local/bin/{{ item }}-mirror-update'
mode: '0755'
loop: '{{ rsync_update_scripts }}'
- name: Set cron flag to enable reporting stats
cron:
name: UNDER_CRON
env: yes
job: '1'
- name: Install update cron jobs
cron:
name: '{{ item }} mirror sync'
state: present
job: 'flock -n /var/run/{{ item }}-mirror.lock {{ item }}-mirror-update mirror.{{ item }} >> /var/log/rsync-mirrors/{{ item }}.log 2>&1'
hour: '*/2'
minute: '{{ 45 | random(seed=item) }}'
loop: '{{ rsync_update_scripts }}'
- name: Install logrotate rules
include_role:
name: logrotate
vars:
logrotate_file_name: '/var/log/rsync-mirrors/{{ item }}.log'
logrotate_frequency: 'weekly'
loop: '{{ rsync_update_scripts }}'