98ab53ee42
We switched Fedora to do vos release via ssh with localauth in I56ecdb2511597197deeeadf51f50da7e02f56954 and it has been working. Switch the rest of the update scripts. There is an increasing amount of common code, start a common functions.sh script where we can put this. Change-Id: I4ba6d64a84bb66e8686901b16010352de942f303
73 lines
1.7 KiB
YAML
73 lines
1.7 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: 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 }}' |