Allow more rsync options

Conflicts:
	rsync/conf/rsyncd.conf
diff --git a/rsync/conf/rsync b/rsync/conf/rsync
index 2060c1d..2612aa1 100644
--- a/rsync/conf/rsync
+++ b/rsync/conf/rsync
@@ -1,3 +1,4 @@
+{% from "rsync/map.jinja" import server with context %}
 {%- if grains.os_family == 'Debian' %}
 # defaults file for rsync daemon mode
 
@@ -27,7 +28,9 @@
 #  the rsync daemon can impact performance due to much I/O and CPU usage,
 #  so you may want to run it at a nicer priority than the default priority.
 #  Allowed values are 0 - 19 inclusive; 10 is a reasonable value.
-RSYNC_NICE=''
+{%- if server.nice %}
+RSYNC_NICE='{{ server.nice }}'
+{%- endif %}
 
 # run rsyncd with ionice?
 #  "ionice" does for IO load what "nice" does for CPU load.
@@ -36,7 +39,9 @@
 #  See the manpage for ionice for allowed options.
 #  -c3 is recommended, this will run rsync IO at "idle" priority. Uncomment
 #  the next line to activate this.
-# RSYNC_IONICE='-c3'
+{%- if server.ionice %}
+RSYNC_IONICE='{{ server.ionice }}'
+{%- endif %}
 
 # Don't forget to create an appropriate config file,
 # else the daemon will not start.
diff --git a/rsync/conf/rsyncd.conf b/rsync/conf/rsyncd.conf
index 2ff5e9c..078f5c5 100644
--- a/rsync/conf/rsyncd.conf
+++ b/rsync/conf/rsyncd.conf
@@ -4,7 +4,9 @@
 gid = {{ server.group }}
 log file = /var/log/rsyncd.log
 pid file = /var/run/rsyncd.pid
+{%- if server.bind is defined %}
 address = {{ server.bind.address }}
+{%- endif %}
 
 {%- for name, module in server.module.iteritems() %}
 [{{ name}}]
@@ -14,4 +16,20 @@
 path = {{ module.path }}
 read only = {{ module.get('read_only', True) }}
 lock file = /var/lock/rsync_{{ name }}.lock
+{%- if module.comment is defined %}
+comment = {{ module.comment }}
+{%- endif %}
+{%- if module.uid is defined %}
+uid = {{ module.uid }}
+{%- endif %}
+{%- if module.gid is defined %}
+gid = {{ module.gid }}
+{%- endif %}
+{%- if module.chroot is defined and module.chroot %}
+use chroot = true
+{%- endif %}
+{%- if module.hosts_allow is defined %}
+hosts allow = {{ module.hosts.allow }}
+hosts deny = *
+{%- endif %}
 {%- endfor %}