diff --git a/README.md b/README.md index ae73855ad346a997f5a405b24e590824b8fee185..a021735e7280c0a30d3df25d4f1ea1fdbb598e51 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ics-ans-role-rsync =================== -Ansible role to install rsync. +Ansible role to install rsync and configure rsyncd.conf for rsync daemon. Rsync copies/sends/backups data between two points by sending only the difference of files from source to destination. @@ -11,13 +11,6 @@ Requirements - ansible >= 2.7 - molecule >= 2.19 -Role Variables --------------- - -```yaml -... -``` - Example Playbook ---------------- @@ -25,17 +18,13 @@ Example Playbook - hosts: servers roles: - role: ics-ans-role-rsync - rsync_server_shares: - - name: servername - comment: Public datasets - path: /data/1 - readonly: no + ``` Role Variables -------------- ```yaml -rsync_server_pool_name: pool +--- # defaults file for rsync-server rsync_server_uid: root rsync_server_gid: root @@ -49,21 +38,26 @@ rsync_server_log_format: "%o %h [%a] %f %'l" rsync_server_pid_path: /var/run/rsyncd.pid rsync_server_readonly: false # rsync_server_timeout: 0 # 0 by default, indicates unlimited. -# rsync_server_max_connections: 0 # 0 by default, indicates unlimited. +rsync_server_max_connections: "0" # indicates unlimited. rsync_server_shares: [] # - name: client_hostname -# path: "{{ rsync_server_pool_name }}/client_hostname" +# path: "poolname/client_hostname" # hosts_allow: 10.4.3.15, 172.30.4.0/24, client_hostname.cslab.esss.lu.se -# comment: dummy client to be replaced in CS-entry -# read_only: false -# uid: nobody -# gid: 13 -# excludes: "lost+found/ test/ .*" -# timeout: 600 -# max_connections: 10 +# options: +# includes: "nothing" +# excludes: "lost+found/ test/ .*" +# exclude_compress: +# timeout: 600 +# comment: "testing client 1" # - name: client2 -# path: "{{ rsync_server_pool_name }}/client2" +# path: "poolname/client2" # hosts_allow: client2.cslab.esss.lu.se client_hostname.cslab.esss.lu.se +# - name: client3 +# path: "poolname/client3" +# hosts_allow: client3.cslab.esss.lu.se +# options: +# excludes: "lost+found/ test/ .*" + License diff --git a/defaults/main.yml b/defaults/main.yml index eb32bfdd7d214fd398795820e642981c59f1cd56..ffdc32a64be405a8b75c1f33e3a247ab21eb02f6 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,5 +1,4 @@ --- -rsync_server_pool_name: pool # defaults file for rsync-server rsync_server_uid: root rsync_server_gid: root @@ -13,18 +12,22 @@ rsync_server_log_format: "%o %h [%a] %f %'l" rsync_server_pid_path: /var/run/rsyncd.pid rsync_server_readonly: false # rsync_server_timeout: 0 # 0 by default, indicates unlimited. -# rsync_server_max_connections: 0 # 0 by default, indicates unlimited. +rsync_server_max_connections: "0" # indicates unlimited. rsync_server_shares: [] # - name: client_hostname -# path: "{{ rsync_server_pool_name }}/client_hostname" +# path: "poolname/client_hostname" # hosts_allow: 10.4.3.15, 172.30.4.0/24, client_hostname.cslab.esss.lu.se -# comment: dummy client to be replaced in CS-entry -# read_only: false -# uid: nobody -# gid: 13 -# excludes: "lost+found/ test/ .*" -# timeout: 600 -# max_connections: 10 +# options: +# includes: "nothing" +# excludes: "lost+found/ test/ .*" +# exclude_compress: +# timeout: 600 +# comment: "testing client 1" # - name: client2 -# path: "{{ rsync_server_pool_name }}/client2" +# path: "poolname/client2" # hosts_allow: client2.cslab.esss.lu.se client_hostname.cslab.esss.lu.se +# - name: client3 +# path: "poolname/client3" +# hosts_allow: client3.cslab.esss.lu.se +# options: +# excludes: "lost+found/ test/ .*" diff --git a/templates/etc-rsyncd-conf.j2 b/templates/etc-rsyncd-conf.j2 index 96d25fea76beef933b0ee274ec082d8fd6314c9e..7dd60eb45a189149653d938f8c0777c5da15a8a9 100644 --- a/templates/etc-rsyncd-conf.j2 +++ b/templates/etc-rsyncd-conf.j2 @@ -33,29 +33,23 @@ read only = {{ rsync_server_readonly }} timeout = {{ rsync_server_timeout | default('0') }} max connections = {{ rsync_server_max_connections | default('0') }} - {% for share in rsync_server_shares %} + [{{ share.name }}] path = {{ share.path }} hosts allow = {{ share.hosts_allow | default('*') }} -comment = {{ share.comment | default(share.path) }} -{% if share.readonly is defined %} -read only = {{ share.readonly }} +{% if share.options is defined %} +{% if share.options.includes is defined %} +include = {{ share.options.includes }} {% endif %} -{% if share.uid is defined %} -uid = {{ share.uid }} +{% if share.options.excludes is defined %} +exclude = {{ share.options.excludes }} {% endif %} -{% if share.gid is defined %} -gid = {{ share.gid }} +{% if share.options.timeout is defined %} +timeout = {{ share.options.timeout }} {% endif %} -{% if share.excludes is defined %} -exclude = {{ share.excludes }} +{% if share.options.comment is defined %} +comment = {{ share.options.comment }} {% endif %} -{% if share.timeout is defined %} -timeout = {{ share.timeout }} {% endif %} -{% if share.max_connections is defined %} -max connections = {{ share.max_connections }} -{% endif %} - {% endfor %}