
The extant "logrotate_daily" varaible doesn't really do anything and isn't used. Modify this to be able to set a range of rotation periods or a size. Update mirror rsync mirrors to rotate weekly, as often releases run overnight and it's a pain to reconstruct. Change-Id: I121dc5f4fe7f226b66d18b9ec39e7e3839be4d40
57 lines
1.5 KiB
YAML
57 lines
1.5 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: 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: 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 }}' |