configure RsyncD

This commit is contained in:
vincent 2019-04-14 11:45:18 +02:00
parent 8bc03f07a6
commit fc16b6d913
4 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,5 @@
rsynclocations:
- name: backup nas
location: /mnt/backup
readonly: "no"
rsynchostalloawed: none

View File

@ -0,0 +1,4 @@
- name: restart rsync
service: name=rsyncd state=restarted
become: yes

View File

@ -0,0 +1,15 @@
- name: rsyncd_conf
action: template src=rsyncd.conf.j2 dest=/etc/rsyncd.conf
notify: restart rsync
become: yes
- name: enable_rsyncd
service:
name: rsyncd # required. Name of the service.
enabled: yes # not required. Whether the service should start on boot. B(At least one of state and enabled are required.)
state: started # not required. choices: reloaded;restarted;started;stopped. C(started)/C(stopped) are idempotent actions that will not run commands unless necessary. C(restarted) will always bounce the service. C(reloaded) will always reload. B(At least one of state and enabled are required.) Note that reloaded will start the service if it is not already started, even if your chosen init system wouldn't normally.
become: yes

14
templates/rsyncd.conf.j2 Normal file
View File

@ -0,0 +1,14 @@
uid = root
gid = root
use chroot = no
max connections = 4
syslog facility = local5
pid file = /run/rsyncd.pid
hosts allow = {{ rsynchostalloawed }}
{% for item in rsynclocations %}
[{{ item.name }}]
path = {{ item.location }}
comment = {{ item.name }}
read only = {{ item.readonly }}
{% endfor %}