git.lirion.de

Of git, get, and gud

summaryrefslogtreecommitdiffstats
path: root/site/profile/manifests/zack_r10k_webhook.pp
diff options
context:
space:
mode:
Diffstat (limited to 'site/profile/manifests/zack_r10k_webhook.pp')
-rw-r--r--site/profile/manifests/zack_r10k_webhook.pp18
1 files changed, 16 insertions, 2 deletions
diff --git a/site/profile/manifests/zack_r10k_webhook.pp b/site/profile/manifests/zack_r10k_webhook.pp
index f35f856..0ab4da2 100644
--- a/site/profile/manifests/zack_r10k_webhook.pp
+++ b/site/profile/manifests/zack_r10k_webhook.pp
@@ -9,11 +9,9 @@ class profile::zack_r10k_webhook (
$git_management_system = hiera('git_management_system', undef)
if $use_mcollective {
-
class { 'r10k::mcollective':
notify => Service['mcollective'],
}
-
}
class {'r10k::webhook::config':
@@ -30,7 +28,23 @@ class profile::zack_r10k_webhook (
require => Class['r10k::webhook::config'],
}
+ $r10k_ssh_key_file = '/root/.ssh/r10k_rsa'
+ exec { 'create r10k ssh key' :
+ command => "/usr/bin/ssh-keygen -t rsa -b 2048 -C 'r10k' -f ${r10k_ssh_key_file} -q -N ''",
+ creates => $r10k_ssh_key_file,
+ }
+
if !empty($gms_api_token) {
+ git_deploy_key { "add_deploy_key_to_puppet_control-${::fqdn}":
+ ensure => present,
+ name => $::fqdn,
+ path => "${r10k_ssh_key_file}.pub",
+ token => $gms_api_token,
+ project_name => 'puppet/control-repo',
+ server_url => hiera('gms_server_url'),
+ provider => $git_management_system,
+ }
+
git_webhook { "web_post_receive_webhook-${::fqdn}" :
ensure => present,
webhook_url => "https://${username}:${password}@${::fqdn}:8088/payload",