Skip to content

Commit

Permalink
changed user to use common.yaml service_user
Browse files Browse the repository at this point in the history
  • Loading branch information
phendryx committed Dec 1, 2012
1 parent cba7454 commit a559df7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 25 deletions.
20 changes: 10 additions & 10 deletions manifests/config.pp
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class sabnzbd::config {
file { "$log_dir":
ensure => directory,
owner => "sabnzbd",
group => "sabnzbd",
owner => "$services_user",
group => "$services_user",
}
if $logrotate {
logrotate::rule { 'sabnzbd':
Expand All @@ -15,28 +15,28 @@
}
file { "$base_dir/sabnzbd/config/":
ensure => directory,
owner => 'sabnzbd',
group => 'sabnzbd',
owner => "$services_user",
group => "$services_user",
}
file { "$base_dir/sabnzbd/config/sabnzbd.ini":
content => template('sabnzbd/sabnzbd.ini.erb'),
owner => 'sabnzbd',
group => 'sabnzbd',
owner => "$services_user",
group => "$services_user",
mode => '0644',
require => File["$base_dir/sabnzbd/config/"],
notify => Service['supervisor::sabnzbd'],
}

file { "$cache_dir":
ensure => directory,
owner => 'sabnzbd',
group => 'sabnzbd',
owner => "$services_user",
group => "$services_user",
mode => '0644',
}
file { "$scripts_dir":
ensure => directory,
owner => 'sabnzbd',
group => 'sabnzbd',
owner => "$services_user",
group => "$services_user",
mode => '0644',
}

Expand Down
27 changes: 12 additions & 15 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,49 +15,46 @@
'python-yenc':
ensure => present;
}
user { 'sabnzbd':
allowdupe => false,
ensure => 'present',
shell => '/bin/bash',
home => "$base_dir/sabnzbd",
password => '*',
}
# user { "$services_user":
# allowdupe => false,
# ensure => 'present',
# }

file { "$base_dir/sabnzbd":
ensure => directory,
owner => 'sabnzbd',
group => 'sabnzbd',
owner => "$services_user",
group => "$services_user",
mode => '0644',
}
exec { 'venv-create-sabnzbd':
command => "virtualenv $venv_dir",
cwd => "$base_dir/sabnzbd",
creates => "$base_dir/sabnzbd/$venv_dir/bin/activate",
path => '/usr/bin/',
user => 'sabnzbd',
user => "$services_user",
require => [Class['python::virtualenv'], Package['python-yenc']];
}
exec { 'download-sabnzbd':
command => "/usr/bin/git clone $url src",
cwd => "$base_dir/sabnzbd",
creates => "$base_dir/sabnzbd/src",
user => 'sabnzbd',
user => "$services_user",
require => Class['git'],
}
exec { 'install-pyopenssl':
command => "$base_dir/sabnzbd/venv/bin/pip install pyOpenSSL",
cwd => "$base_dir/sabnzbd/venv",
creates => "$base_dir/sabnzbd/venv/lib/python2.7/site-packages/OpenSSL",
path => "$base_dir/sabnzbd/venv/bin:/usr/bin",
user => 'sabnzbd',
user => "$services_user",
require => Exec['venv-create-sabnzbd'];
}
exec { 'install-cheetah-sabnzbd':
command => "$base_dir/sabnzbd/venv/bin/pip install cheetah",
cwd => "$base_dir/sabnzbd/venv",
creates => "$base_dir/sabnzbd/venv/bin/cheetah",
path => "$base_dir/sabnzbd/venv/bin",
user => 'sabnzbd',
user => "$services_user",
require => Exec['venv-create-sabnzbd'];
}
supervisor::service {
Expand All @@ -67,8 +64,8 @@
stdout_logfile => "$base_dir/sabnzbd/log/supervisor.log",
stderr_logfile => "$base_dir/sabnzbd/log/supervisor.log",
command => "$base_dir/sabnzbd/venv/bin/python $base_dir/sabnzbd/src/SABnzbd.py -f $base_dir/sabnzbd/config/sabnzbd.ini",
user => 'sabnzbd',
group => 'sabnzbd',
user => "$services_user",
group => "$services_user",
directory => "$base_dir/sabnzbd/src/",
require => Exec['download-sabnzbd'],
}
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
$logrotate = hiera("logrotate", "false"),
)
{
$services_user = hiera("services_user")
$scripts_dir = "$base_dir/sabnzbd/scripts"
$log_dir = "$base_dir/sabnzbd/log"
$admin_dir = "$base_dir/sabnzbd/admin"
Expand Down

3 comments on commit a559df7

@liamjbennett
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,
Can I ask what is the use case for this change? What user are you using in your config?

@phendryx
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did this so that the user is configurable. I forked a project called media-server that uses puppet to install sickbeard/sabnzbd/couchpotato/headphones and it's easier to set them all to use the same user, such as 'media', so you can delete tv shows once you've watched them, for example. Not all of the software packages set the right permissions for groups, unfortunately.

@liamjbennett
Copy link

@liamjbennett liamjbennett commented on a559df7 Dec 29, 2012 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.