diff --git a/roles/mirrormanager/frontend2/tasks/main.yml b/roles/mirrormanager/frontend2/tasks/main.yml index 4083e5d476..286a2a325b 100644 --- a/roles/mirrormanager/frontend2/tasks/main.yml +++ b/roles/mirrormanager/frontend2/tasks/main.yml @@ -65,3 +65,19 @@ tags: - mm2_frontend - config + +- name: install crawler log sync + template: src=sync-crawler-logs.sh dest=/usr/local/bin/sync-crawler-logs.sh mode=0755 + - mm2_frontend + +- name: create /var/log/mirrormanager/crawler + file: path=/var/log/mirrormanager/crawler state=directory owner=mirrormanager group=mirrormanager mode=0755 + tags: + - mm2_frontend + - config + +- name: install the cron job + template: src=frontend.cron dest=/etc/cron.d/mm2_frontend.cron + tags: + - config + - mm2_frontend diff --git a/roles/mirrormanager/frontend2/templates/frontend.cron b/roles/mirrormanager/frontend2/templates/frontend.cron new file mode 100644 index 0000000000..6725774b2d --- /dev/null +++ b/roles/mirrormanager/frontend2/templates/frontend.cron @@ -0,0 +1,4 @@ +MAILTO=root + +# sync crawler logs every hour +55 * * * * mirrormanager /usr/local/bin/sync-crawler-logs.sh diff --git a/roles/mirrormanager/frontend2/templates/sync-crawler-logs.sh b/roles/mirrormanager/frontend2/templates/sync-crawler-logs.sh new file mode 100644 index 0000000000..06ac15dea2 --- /dev/null +++ b/roles/mirrormanager/frontend2/templates/sync-crawler-logs.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +CRAWLERS="{% for host in groups['mm-crawler'] %} {{ host }} {% endfor %}" + +for i in ${CRAWLERS}; do + rsync -aq ${i}::crawler/ /var/log/mirrormanager/crawler/ +done