Upgrade some notifies to warnings
[mirror/dsa-puppet.git] / modules / ssh / manifests / keygen.pp
1 # create an ssh key for user
2 define ssh::keygen(
3   String $user = $name,
4 ) {
5   if $facts["${user}_user_exists"] == undef {
6     notify { "We do not have facters for user ${user} existance and keys -- add it to modules/debian_org/lib/facter/roleaccounts.rb":
7       loglevel => warning,
8     }
9   } elsif $facts["${user}_user_exists"] {
10     if ! $facts["${user}_key"] {
11       exec { "create-${user}-ssh-key":
12         command => @("EOF"),
13           /bin/su - ${user} -c 'mkdir -p -m 02700 .ssh && ssh-keygen -C "`whoami`@`hostname` (`date +%Y-%m-%d`)" -P "" -f .ssh/id_rsa -q'
14           | EOF
15         onlyif  => "/usr/bin/getent passwd ${user} > /dev/null && ! [ -e ~${user}/.ssh/id_rsa ]"
16       }
17     }
18   } else {
19     notify { "User ${user} does not exist on this host.  Will not create ssh key":
20       loglevel => warning,
21     }
22   }
23 }