From 5579ba8c9859d2570f08f2b26e80373bb2675d35 Mon Sep 17 00:00:00 2001 From: Mike Pirog Date: Mon, 15 Oct 2012 14:39:21 -0700 Subject: [PATCH] autogen ssh keys --- modules/git/manifests/config.pp | 4 ++-- modules/phpmyadmin/manifests/config.pp | 8 ++++---- modules/ssh/manifests/server.pp | 3 +-- modules/ssh/manifests/server/config.pp | 17 +++++++++++++++++ 4 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 modules/ssh/manifests/server/config.pp diff --git a/modules/git/manifests/config.pp b/modules/git/manifests/config.pp index 260f624..cf5b4ed 100644 --- a/modules/git/manifests/config.pp +++ b/modules/git/manifests/config.pp @@ -10,7 +10,7 @@ path => "/bin:/usr/bin", unless => "grep name /home/${::kala_user}/.gitconfig", command => "sudo -u ${::kala_user} git config --global user.name \"${::kala_name}\"", - require => Class[git::install], + require => Class["git::install"], } # Sets the git email @@ -18,7 +18,7 @@ path => "/bin:/usr/bin", unless => "grep email /home/${::kala_user}/.gitconfig", command => "sudo -u ${::kala_user} git config --global user.email \"${::kala_user}@${::hostname}\"", - require => Class[git::install], + require => Class["git::install"], } } diff --git a/modules/phpmyadmin/manifests/config.pp b/modules/phpmyadmin/manifests/config.pp index 1a2a507..4562e58 100644 --- a/modules/phpmyadmin/manifests/config.pp +++ b/modules/phpmyadmin/manifests/config.pp @@ -29,8 +29,8 @@ unless => "mysql -uroot -p${php_pass} ${pma_db}", command => "gunzip < /usr/share/doc/phpmyadmin/examples/create_tables.sql.gz | mysql -u${pma_user} -p${pma_pass} -h${pma_server}", require => [ - Class[phpmyadmin::install], - Class[network::config] + Class["phpmyadmin::install"], + Class["network::config"] ], } @@ -50,7 +50,7 @@ owner => "root", group => "root", mode => 0444, - require => Class[phpmyadmin::install], + require => Class["phpmyadmin::install"], } # Sets the above creds for the DB @@ -61,7 +61,7 @@ owner => "root", group => "root", mode => 0444, - require => Class[phpmyadmin::install], + require => Class["phpmyadmin::install"], } } \ No newline at end of file diff --git a/modules/ssh/manifests/server.pp b/modules/ssh/manifests/server.pp index ddff562..e95a733 100644 --- a/modules/ssh/manifests/server.pp +++ b/modules/ssh/manifests/server.pp @@ -5,7 +5,6 @@ */ class ssh::server { - include ssh::server::install - include ssh::server::service + include ssh::server::install, ssh::server::config, ssh::server::service } diff --git a/modules/ssh/manifests/server/config.pp b/modules/ssh/manifests/server/config.pp new file mode 100644 index 0000000..6dfb321 --- /dev/null +++ b/modules/ssh/manifests/server/config.pp @@ -0,0 +1,17 @@ +/** + * + * Generates SSH keys for the kala_user + * + */ +class ssh::server::config { + + # autogen ssh keys + exec { "sshkeygen": + path => "/bin:/usr/bin", + unless => "cat /home/${::kala_user}/.ssh/id_rsa.pub", + command => "sudo -u ${::kala_user} ssh-keygen", + require => Class["ssh:server::install"], + notify => Class["ssh::server::service"], + } + +} \ No newline at end of file