ftpsync role

certbot_on_virtu
Alexandre Iooss 2020-03-30 20:17:27 +02:00
parent fa7c93884b
commit 5bf423027e
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02
5 changed files with 123 additions and 1 deletions

View File

@ -78,7 +78,7 @@
roles:
- ansible
# Tools for memebers
# Tools for members
- hosts: zamok.adm.crans.org
roles:
- zamok-tools

View File

@ -0,0 +1,28 @@
---
# For installation instruction, see /usr/share/doc/ftpsync/README.md.gz
# Not everything is up to date in this README, be careful!
- name: Install ftpsync
apt:
update_cache: true
name: ftpsync
register: apt_result
retries: 3
until: apt_result is succeeded
# 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: Copy ftpsync configurations
template:
src: ftpsync.conf.j2
dest: "/etc/ftpsync/ftpsync-{{ item.name }}.conf"
loop: "{{ ftpsync }}"
- name: Configure ftpsync cron
template:
src: ftpsync-cron.j2
dest: /etc/cron.d/ftpsync

View File

@ -0,0 +1,4 @@
# {{ ansible_managed }}
{% for i in ftpsync %}
{{ i.cron_time }} * * * mirror ftpsync sync:archive:{{ i.name }}
{% endfor %}

View File

@ -0,0 +1,48 @@
# {{ ansible_managed }}
# MIRRORNAME=`hostname -f`
TO="{{ item.dest }}"
MAILTO="root"
# HUB=false
########################################################################
## Connection options
########################################################################
RSYNC_HOST="{{ item.rsync_host }}"
RSYNC_PATH="{{ item.rsync_path }}"
# RSYNC_USER=
# RSYNC_PASSWORD=
########################################################################
## Mirror information options
########################################################################
# INFO_MAINTAINER="Admins <admins@example.com>, Person <person@example.com>"
# INFO_SPONSOR="Example <https://example.com>"
# INFO_COUNTRY=DE
# INFO_LOCATION="Example"
# INFO_THROUGHPUT=10Gb
########################################################################
## Include and exclude options
########################################################################
# ARCH_INCLUDE=
# ARCH_EXCLUDE=
########################################################################
## Log option
########################################################################
LOGDIR="/var/log/mirror"
## If you do want a mail about every single sync, set this to false
## Everything else will only send mails if a mirror sync fails
ERRORSONLY="true"
## If you want the logs to also include output of rsync, set this to true.
## Careful, the logs can get pretty big, especially if it is the first mirror
## run
FULLLOGS="false"

View File

@ -31,3 +31,45 @@
- hosts: cochon.adm.crans.org
roles:
- mumudvb
# Mirrors
- hosts: charybde.adm.crans.org
vars:
ftpsync:
- name: main
dest: /pubftp/pub/debian/
cron_time: "25 1,13"
rsync_host: ftp.fr.debian.org
rsync_path: debian
- name: security
dest: /pubftp/pub/debian-security/
cron_time: "40 *"
rsync_host: ftp.fr.debian.org
rsync_path: debian-security
- name: backports
dest: /pubftp/pub/debian-backports/
cron_time: " 7 3,15"
rsync_host: ftp.fr.debian.org
rsync_path: debian-backports
- name: ports
dest: /pubftp/pub/debian-ports/
cron_time: " 7 3,15"
rsync_host: deb.debian.org
rsync_path: debian-ports
- name: multimedia
dest: /pubftp/pub/debian-multimedia/
cron_time: "49 4,16"
rsync_host: www.deb-multimedia.org
rsync_path: deb
- name: ubuntu
dest: /pubftp/pub/ubuntu/
cron_time: "55 5,17"
rsync_host: ftp.lip6.fr
rsync_path: Ubuntu/archive/
roles:
- ftpsync