class etherpad( $db_password = lookup('etherpad::db_password', undef, undef, ''), $admin_password = lookup('etherpadd::admin_password', undef, undef, ''), $api_key = lookup('etherpad::api_key', undef, undef, '') ) { case $db_password { '': { fail("You need to define etherpad database password! Please set etherpadd::db_password in your config") } } mysql_database { 'etherpad': ensure => present, } mysql_user { "etherpad@%": ensure => present, password_hash => mysql_password($db_password), require => Mysql_database['etherpad'], } mysql_grant { "etherpad@%/etherpad": privileges => 'all', require => Mysql_user["etherpad@%"], } group { "etherpad-lite": ensure => present, allowdupe => false, } user { "etherpad-lite": ensure => present, allowdupe => false, gid => 'etherpad-lite', require => Group['etherpad-lite'], } file { '/home/etherpad-lite': ensure => directory, owner => 'etherpad-lite', group => 'etherpad-lite', require => User['etherpad-lite'], } package { [ 'npm', 'abiword' ]: ensure => present, } vcsrepo { "/var/lib/etherpad-lite": ensure => present, provider => git, source => 'https://github.com/ether/etherpad-lite.git', revision => '8fffe4777e366923ee89d380b12eb413c950b721', 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'], } if $api_key != '' { file { '/var/lib/etherpad-lite/APIKEY.txt': ensure => present, owner => 'etherpad-lite', group => 'etherpad-lite', mode => '0640', content => "${api_key}", 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', '/home/etherpad-lite'], Mysql_grant['etherpad@%/etherpad'], Package['npm'] ], } }