diff options
author | Jamie McClelland <jm@mayfirst.org> | 2011-03-19 23:27:16 -0400 |
---|---|---|
committer | Jamie McClelland <jm@mayfirst.org> | 2011-03-19 23:27:16 -0400 |
commit | 6daf83e2b81d4a33bb1739c9f4b6c9882e6e1ea2 (patch) | |
tree | 67efc7b9fab7d747283d9e65d43937209d3db4b3 /manifests | |
parent | 6356f78198821c2e363b65a55c987929eeee178a (diff) | |
download | puppet-monkeysphere-6daf83e2b81d4a33bb1739c9f4b6c9882e6e1ea2.tar.gz puppet-monkeysphere-6daf83e2b81d4a33bb1739c9f4b6c9882e6e1ea2.tar.bz2 |
ensure config files are in place before executing monkeysphere commands
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/init.pp | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/manifests/init.pp b/manifests/init.pp index 7ecf5a1..c25e1f7 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -24,20 +24,20 @@ class monkeysphere inherits monkeysphere::defaults { # The needed packages package { monkeysphere: ensure => installed, } - file { - "/etc/monkeysphere/monkeysphere.conf": + file { "monkeysphere_conf": + path => "/etc/monkeysphere/monkeysphere.conf", mode => 644, ensure => present, content => template("monkeysphere/monkeysphere.conf.erb"), } - file { - "/etc/monkeysphere/monkeysphere-host.conf": + file { "monkeysphere_host_conf": + path => "/etc/monkeysphere/monkeysphere-host.conf", mode => 644, ensure => present, content => template("monkeysphere/monkeysphere-host.conf.erb"), } - file { - "/etc/monkeysphere/monkeysphere-authentication.conf": + file { "monkeysphere_authentication_conf": + path => "/etc/monkeysphere/monkeysphere-authentication.conf", mode => 644, ensure => present, content => template("monkeysphere/monkeysphere-authentication.conf.erb"), @@ -59,11 +59,11 @@ define monkeysphere::import_key ( $scheme = 'ssh://', $port = '', $path = '/etc/ default => ":$port" } - $key = "${schema}://${fqdn}${prefixed_port}" + $key = "${scheme}${fqdn}${prefixed_port}" exec { "monkeysphere-host import-key $path $key": alias => "monkeysphere-import-key", - require => [ Package["monkeysphere"] ], + require => [ Package["monkeysphere"], File["monkeysphere_host_conf"] ], unless => "/usr/sbin/monkeysphere-host s | grep $key > /dev/null" } } @@ -72,7 +72,7 @@ define monkeysphere::import_key ( $scheme = 'ssh://', $port = '', $path = '/etc/ define monkeysphere::publish_keys ( $keyid = '--all' ) { exec { "monkeysphere-host publish-keys $keyid": environment => "MONKEYSPHERE_PROMPT=false", - require => [ Package["monkeysphere"], Exec["monkeysphere-import-key"] ], + require => [ Package["monkeysphere"], Exec["monkeysphere-import-key"], File["monkeysphere_host_conf"] ], } } @@ -87,23 +87,29 @@ define monkeysphere::email_keys ( $email = 'root' ) { define monkeysphere::add_id_certifier( $keyid ) { exec { "monkeysphere-authentication add-id-certifier $keyid": environment => "MONKEYSPHERE_PROMPT=false", - require => [ Package["monkeysphere"] ], + require => [ Package["monkeysphere"], File["monkeysphere_authentication_conf"] ], unless => "/usr/sbin/monkeysphere-authentication list-id-certifiers | grep $keyid > /dev/null" } } -define monkeysphere::authorized_user_ids( $source, $user = 'root', $group = $user, $dest_dir = '/root/.monkeysphere', $dest_file = '.authorized_user_ids') { +define monkeysphere::authorized_user_ids( $source, $dest_dir = '/root/.monkeysphere', $dest_file = '.authorized_user_ids', $group = '') { + $user = $title + $calculated_group = $group ? { + '' => $user, + default => $group + } + file { $dest_dir: owner => $user, - group => $group, + group => $calculated_group, mode => 755, ensure => directory, } file { "${dest_dir}/${dest_file}": owner => $user, - group => $group, + group => $calculated_group, mode => 644, source => $source, ensure => present, @@ -111,8 +117,8 @@ define monkeysphere::authorized_user_ids( $source, $user = 'root', $group = $use } exec { "monkeysphere-authentication update-users $user": - require => [ Package["monkeysphere"] ], refreshonly => true, + require => [ File["monkeysphere_authentication_conf"], Package["monkeysphere"] ], subscribe => File["${dest_dir}/${dest_file}"] } } |