summaryrefslogtreecommitdiff
path: root/manifests/init.pp
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/init.pp')
-rw-r--r--manifests/init.pp88
1 files changed, 88 insertions, 0 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
index d8465f2..e5e8f35 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -1,2 +1,90 @@
class cherrymusic {
+ package { [
+ 'python3-cherrypy3',
+ 'lame',
+ ]:
+ ensure => present,
+ }
+
+ group { "cherrymusic":
+ ensure => present,
+ allowdupe => false,
+ }
+
+ user { "cherrymusic":
+ ensure => present,
+ allowdupe => false,
+ shell => '/bin/false',
+ gid => 'cherrymusic',
+ home => '/var/lib/cherrymusic',
+ require => Group['cherrymusic'],
+ }
+
+ file { [
+ '/var/lib/cherrymusic',
+ '/var/lib/cherrymusic/.config',
+ '/var/lib/cherrymusic/.config/cherrymusic',
+ ]:
+ ensure => directory,
+ owner => 'cherrymusic',
+ group => 'cherrymusic',
+ mode => '0750',
+ require => User['cherrymusic'],
+ }
+
+ file { '/var/lib/cherrymusic/.config/cherrymusic/cherrymusic.conf':
+ ensure => present,
+ owner => 'cherrymusic',
+ group => 'cherrymusic',
+ mode => '0644',
+ source => [
+ 'puppet:///modules/site_cherrymusic/cherrymusic.conf',
+ 'puppet:///modules/cherrymusic/cherrymusic.conf',
+ ],
+ require => File['/var/lib/cherrymusic/.config/cherrymusic'],
+ }
+
+ file { '/etc/systemd/system/cherrymusic@.service':
+ ensure => present,
+ owner => root,
+ group => root,
+ mode => '0644',
+ source => 'puppet:///modules/cherrymusic/cherrymusic@.service',
+ notify => Exec['systemctl-enable-cherrymusic'],
+ }
+
+ exec { 'systemctl-enable-cherrymusic':
+ command => '/bin/systemctl daemon-reload && /bin/systemctl enable cherrymusic@cherrymusic',
+ require => File['/etc/systemd/system/cherrymusic@.service'],
+ user => root,
+ refreshonly => true,
+ }
+
+ #file { '/usr/local/bin/cherrymusic':
+ # ensure => present,
+ # owner => root,
+ # group => root,
+ # mode => '0755',
+ # content => "/usr/bin/python3 /usr/local/share/cherrymusic/cherrymusic\n"
+ #}
+
+ vcsrepo { '/usr/local/share/cherrymusic':
+ ensure => present,
+ owner => root,
+ group => root,
+ user => root,
+ provider => git,
+ source => 'https://github.com/devsnd/cherrymusic',
+ revision => '911b757b6e3a59d3be5fded9e7ab08b0807959fa',
+ }
+
+ service { 'cherrymusic@cherrymusic':
+ ensure => running,
+ enable => true,
+ require => [
+ File['/var/lib/cherrymusic/.config/cherrymusic/cherrymusic.conf', '/etc/systemd/system/cherrymusic@.service', ], # '/usr/local/bin/cherrymusic'],
+ Vcsrepo['/usr/local/share/cherrymusic'],
+ Exec['systemctl-enable-cherrymusic'],
+ ],
+ }
}