diff --git a/manifests/site.pp b/manifests/site.pp index a0f927b504..b15f77a2b3 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -20,6 +20,8 @@ node 'review.openstack.org' { mysql_password => hiera('gerrit_mysql_password'), email_private_key => hiera('gerrit_email_private_key'), gerritbot_password => hiera('gerrit_gerritbot_password'), + gerritbot_ssh_rsa_key_contents => hiera('gerritbot_ssh_rsa_key_contents'), + gerritbot_ssh_rsa_pubkey_contents => hiera('gerritbot_ssh_rsa_pubkey_contents'), ssl_cert_file_contents => hiera('gerrit_ssl_cert_file_contents'), ssl_key_file_contents => hiera('gerrit_ssl_key_file_contents'), ssl_chain_file_contents => hiera('gerrit_ssl_chain_file_contents'), diff --git a/modules/gerritbot/manifests/init.pp b/modules/gerritbot/manifests/init.pp index add7699466..b1d2c678b7 100644 --- a/modules/gerritbot/manifests/init.pp +++ b/modules/gerritbot/manifests/init.pp @@ -5,7 +5,9 @@ class gerritbot( $password = '', $server = '', $user = '', - $vhost_name = '' + $vhost_name = '', + $ssh_rsa_key_contents = '', + $ssh_rsa_pubkey_contents = '', ) { include pip @@ -76,6 +78,28 @@ class gerritbot( replace => true, require => User['gerrit2'], } + + if $ssh_rsa_key_contents != '' { + file { '/home/gerrit2/.ssh/gerritbot_rsa': + owner => 'gerrit2', + group => 'gerrit2', + mode => '0600', + content => $ssh_rsa_key_contents, + replace => true, + require => File['/home/gerrit2/.ssh'] + } + } + + if $ssh_rsa_pubkey_contents != '' { + file { '/home/gerrit2/.ssh/gerritbot_rsa.pub': + owner => 'gerrit2', + group => 'gerrit2', + mode => '0644', + content => $ssh_rsa_pubkey_contents, + replace => true, + require => File['/home/gerrit2/.ssh'] + } + } } # vim:sw=2:ts=2:expandtab:textwidth=79 diff --git a/modules/openstack_project/manifests/review.pp b/modules/openstack_project/manifests/review.pp index cad05c8f76..1d00ab3c76 100644 --- a/modules/openstack_project/manifests/review.pp +++ b/modules/openstack_project/manifests/review.pp @@ -43,6 +43,8 @@ class openstack_project::review ( $email_private_key = '', # Register an IRC bot and supply it's password here. $gerritbot_password = '', + $gerritbot_ssh_rsa_key_contents = '', + $gerritbot_ssh_rsa_pubkey_contents = '', # Register SSL keys and pass their contents in. $ssl_cert_file_contents = '', $ssl_key_file_contents = '', @@ -182,11 +184,13 @@ class openstack_project::review ( } class { 'gerritbot': - nick => 'openstackgerrit', - password => $gerritbot_password, - server => 'irc.freenode.net', - user => 'gerritbot', - vhost_name => $::fqdn, + nick => 'openstackgerrit', + password => $gerritbot_password, + server => 'irc.freenode.net', + user => 'gerritbot', + vhost_name => $::fqdn, + ssh_rsa_key_contents => $gerritbot_ssh_rsa_key_contents, + ssh_rsa_pubkey_contents => $gerritbot_ssh_rsa_pubkey_contents, } class { 'gerrit::remotes': ensure => absent,