From b7d33d4e093dc5dd494abf799481f9fb73017b21 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Mon, 30 Mar 2020 20:53:08 +0200 Subject: [PATCH] rsync mirror cdimages --- roles/rsync-mirror/tasks/main.yml | 12 ++++++ .../templates/rsync-mirror-cron.j2 | 4 ++ services_web.yml | 38 +++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 roles/rsync-mirror/tasks/main.yml create mode 100644 roles/rsync-mirror/templates/rsync-mirror-cron.j2 diff --git a/roles/rsync-mirror/tasks/main.yml b/roles/rsync-mirror/tasks/main.yml new file mode 100644 index 00000000..3900dd59 --- /dev/null +++ b/roles/rsync-mirror/tasks/main.yml @@ -0,0 +1,12 @@ +--- +# cron run as mirror user +- name: Add the mirror user + user: + name: mirror + home: /var/mirror # unused, should be something empty + shell: /bin/false + +- name: Configure ftpsync cron + template: + src: rsync-mirror-cron.j2 + dest: /etc/cron.d/rsync-mirror diff --git a/roles/rsync-mirror/templates/rsync-mirror-cron.j2 b/roles/rsync-mirror/templates/rsync-mirror-cron.j2 new file mode 100644 index 00000000..427ec897 --- /dev/null +++ b/roles/rsync-mirror/templates/rsync-mirror-cron.j2 @@ -0,0 +1,4 @@ +# {{ ansible_managed }} +{% for i in rsync_mirror %} +{{ i.cron_time }} * * * mirror rsync --times --links --hard-links --partial --block-size=8192 --recursive --exclude *-dvd-* --exclude source/ --verbose --stats --delete-after rsync://{{ i.rsync_host }}/{{ i.rsync_path }} {{ i.dest }} | tee -a "/var/log/mirror/{{ i.name }}.log" +{% endfor %} diff --git a/services_web.yml b/services_web.yml index c86c121d..7c17c156 100644 --- a/services_web.yml +++ b/services_web.yml @@ -71,5 +71,43 @@ cron_time: "55 5,17" rsync_host: ftp.lip6.fr rsync_path: Ubuntu/archive/ + + rsync_mirror: + - name: videolan + dest: /pubftp/pub/videolan + cron_time: "03 10,14,18,22,2,6" + rsync_host: rsync.videolan.org + rsync_path: videolan-ftp + + - name: ubuntu + dest: /pubftp/pub/distributions/linux/ubuntu + cron_time: "00 5" + rsync_host: cdimage.ubuntu.com + rsync_path: cdimage/ubuntu/releases + + - name: xubuntu + dest: /pubftp/pub/distributions/linux/xubuntu + cron_time: "00 5" + rsync_host: cdimage.ubuntu.com + rsync_path: cdimage/xubuntu/releases + + - name: kubuntu + dest: /pubftp/pub/distributions/linux/kubuntu + cron_time: "00 5" + rsync_host: cdimage.ubuntu.com + rsync_path: cdimage/kubuntu/releases + + - name: lubuntu + dest: /pubftp/pub/distributions/linux/lubuntu + cron_time: "00 5" + rsync_host: cdimage.ubuntu.com + rsync_path: cdimage/lubuntu/releases + + - name: ubuntu-mate + dest: /pubftp/pub/distributions/linux/ubuntu-mate + cron_time: "00 5" + rsync_host: cdimage.ubuntu.com + rsync_path: cdimage/ubuntu-mate/releases roles: - ftpsync + - rsync-mirror