From b0bf1a0a9507bad52d1a5f5c2a0afb7ce61d6170 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sat, 29 Dec 2018 21:33:34 -0200 Subject: Working setup --- manifests/init.pp | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) (limited to 'manifests') 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'], + ], + } } -- cgit v1.2.3