summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2012-09-27 14:37:48 -0300
committerSilvio Rhatto <rhatto@riseup.net>2012-09-27 14:37:48 -0300
commit5e9a2b52628b1c3cd666ef8645fc4bfba36b6d5f (patch)
tree63b1fb4b71bd57b1c496e854313ede634b7b9099
parent0519775fae697ae72c6cd12b733f2a01bcf622b5 (diff)
downloadpuppet-rsync-5e9a2b52628b1c3cd666ef8645fc4bfba36b6d5f.tar.gz
puppet-rsync-5e9a2b52628b1c3cd666ef8645fc4bfba36b6d5f.tar.bz2
Adding rsync::server class
-rw-r--r--files/server/default41
-rw-r--r--files/server/logrotate.conf8
-rw-r--r--files/server/rsyncd.conf42
-rw-r--r--manifests/server.pp48
4 files changed, 139 insertions, 0 deletions
diff --git a/files/server/default b/files/server/default
new file mode 100644
index 0000000..3f8ab26
--- /dev/null
+++ b/files/server/default
@@ -0,0 +1,41 @@
+# defaults file for rsync daemon mode
+
+# start rsync in daemon mode from init.d script?
+# only allowed values are "true", "false", and "inetd"
+# Use "inetd" if you want to start the rsyncd from inetd,
+# all this does is prevent the init.d script from printing a message
+# about not starting rsyncd (you still need to modify inetd's config yourself).
+RSYNC_ENABLE=true
+
+# which file should be used as the configuration file for rsync.
+# This file is used instead of the default /etc/rsyncd.conf
+# Warning: This option has no effect if the daemon is accessed
+# using a remote shell. When using a different file for
+# rsync you might want to symlink /etc/rsyncd.conf to
+# that file.
+# RSYNC_CONFIG_FILE=
+
+# what extra options to give rsync --daemon?
+# that excludes the --daemon; that's always done in the init.d script
+# Possibilities are:
+# --address=123.45.67.89 (bind to a specific IP address)
+# --port=8730 (bind to specified port; default 873)
+RSYNC_OPTS=''
+
+# run rsyncd at a nice level?
+# 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=''
+
+# run rsyncd with ionice?
+# "ionice" does for IO load what "nice" does for CPU load.
+# As rsync is often used for backups which aren't all that time-critical,
+# reducing the rsync IO priority will benefit the rest of the system.
+# 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'
+
+# Don't forget to create an appropriate config file,
+# else the daemon will not start.
diff --git a/files/server/logrotate.conf b/files/server/logrotate.conf
new file mode 100644
index 0000000..d15fc71
--- /dev/null
+++ b/files/server/logrotate.conf
@@ -0,0 +1,8 @@
+/var/log/rsyncd.log {
+ weekly
+ rotate 99
+ missingok
+ notifempty
+ compress
+ delaycompress
+}
diff --git a/files/server/rsyncd.conf b/files/server/rsyncd.conf
new file mode 100644
index 0000000..2a637d1
--- /dev/null
+++ b/files/server/rsyncd.conf
@@ -0,0 +1,42 @@
+# sample rsyncd.conf configuration file
+
+# GLOBAL OPTIONS
+
+#motd file=/etc/motd
+#log file=/var/log/rsyncd
+# for pid file, do not use /var/run/rsync.pid if
+# you are going to run rsync out of the init.d script.
+# pid file=/var/run/rsyncd.pid
+#syslog facility=daemon
+#socket options=
+
+# MODULE OPTIONS
+
+[ftp]
+
+ comment = public archive
+ path = /var/www/pub
+ use chroot = yes
+# max connections=10
+ lock file = /var/lock/rsyncd
+# the default for read only is yes...
+ read only = yes
+ list = yes
+ uid = nobody
+ gid = nogroup
+# exclude =
+# exclude from =
+# include =
+# include from =
+# auth users =
+# secrets file = /etc/rsyncd.secrets
+ strict modes = yes
+# hosts allow =
+# hosts deny =
+ ignore errors = no
+ ignore nonreadable = yes
+ transfer logging = no
+# log format = %t: host %h (%a) %o %f (%l bytes). Total %b bytes.
+ timeout = 600
+ refuse options = checksum dry-run
+ dont compress = *.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz
diff --git a/manifests/server.pp b/manifests/server.pp
new file mode 100644
index 0000000..c6bfec2
--- /dev/null
+++ b/manifests/server.pp
@@ -0,0 +1,48 @@
+# manifests/server.pp
+
+class rsync::server {
+ package {'rsync':
+ ensure => installed,
+ }
+
+ file { '/etc/rsyncd.conf':
+ ensure => present,
+ owner => root,
+ group => root,
+ mode => 0644,
+ notify => Service['rsync'],
+ require => Package['rsync'],
+ source => [ "puppet:///modules/site-rsync/$domain/rsyncd.conf",
+ "puppet:///modules/site-rsync/rsyncd.conf",
+ "puppet:///modules/rsync/server/rsyncd.conf" ],
+ }
+
+ file { '/etc/default/rsync':
+ ensure => present,
+ owner => root,
+ group => root,
+ mode => 0644,
+ notify => Service['rsync'],
+ require => Package['rsync'],
+ source => [ "puppet:///modules/site-rsync/$domain/default",
+ "puppet:///modules/site-rsync/default",
+ "puppet:///modules/rsync/server/default" ],
+ }
+
+ file { [ '/etc/logrotate.d/rsync' ]:
+ ensure => present,
+ owner => root,
+ group => root,
+ mode => 0644,
+ require => Package['rsync'],
+ source => [ "puppet:///modules/site-rsync/$domain/logrotate.conf",
+ "puppet:///modules/site-rsync/logrotate.conf",
+ "puppet:///modules/rsync/server/logrotate.conf" ],
+ }
+
+ service { 'rsync':
+ enable => true,
+ ensure => running,
+ require => File['/etc/rsyncd.conf', '/etc/default/rsync' ],
+ }
+}