class etherpad { case $etherpad_db_password { '': { fail("You need to define a mysql root password! Please set \$etherpad_db_password in your site.pp or host config") } } database::instance { "etherpad": password => $etherpad_db_password, } user { "etherpad-lite": ensure => present, allowdupe => false, } group { "etherpad-lite": ensure => present, allowdupe => false, } package { 'npm': ensure => present, } vcsrepo { "/var/lib/etherpad-lite": ensure => present, provider => git, source => 'git://github.com/Pita/etherpad-lite.git', revision => 'ddf1cd345c8516a77c1440b53ddc05279551db7b' owner => 'etherpad-lite', group => 'etherpad-lite', require => [ User['etherpad-lite'], Group['etherpad-lite'] ], notify => Service['etherpad-lite'], } file { '/etc/init.d/etherpad-lite': ensure => present, owner => root, group => root, mode => 0755, source => 'puppet:///modules/etherpad/init.d/etherpad-lite.sh', require => Vcsrepo['/var/lib/etherpad-lite'], } file { '/var/log/etherpad-lite': ensure => directory, owner => 'etherpad-lite', group => 'etherpad-lite', mode => 0755, require => [ User['etherpad-lite'], Group['etherpad-lite'] ], } file { '/etc/logrotate.d/etherpad-lite': ensure => present, owner => root, group => root, mode => 0644, source => 'puppet:///modules/etherpad/logrotate.d/etherpad-lite', require => File['/var/log/etherpad-lite'], } file { '/var/lib/etherpad-lite/settings.json': ensure => present, owner => 'etherpad-lite', group => 'etherpad-lite', mode => 0640, content => template('etherpad/settings.json.erb'), require => Vcsrepo['/var/lib/etherpad-lite'], notify => Service['etherpad-lite'], } service { 'etherpad-lite': enable => true, ensure => running, hasrestart => true, hasstatus => true, require => [ File['/etc/init.d/etherpad-lite', '/var/lib/etherpad-lite/settings.json'], Mysql_database['etherpad-lite'], Mysql_user['etherpad-lite'], Mysql_grant['etherpad-lite'], Package['npm'] ], } }