Skip to content

Commit 8e271e3

Browse files
committed
Change the zack/r10k webhook to utilize username and password
To accomodate generating random usernames and passwords, I had to parameterize the profiles which I didn't feel great about but I also didn't want to have to put the username and pass in hiera.
1 parent 3fcf6e3 commit 8e271e3

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

site/profile/manifests/puppetmaster.pp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
class profile::puppetmaster {
1+
class profile::puppetmaster (
2+
$webhook_username,
3+
$webhook_password
4+
) {
25

36
class { 'hiera':
47
hierarchy => [
@@ -38,7 +41,7 @@
3841

3942
git_webhook { "web_post_receive_webhook-${::fqdn}" :
4043
ensure => present,
41-
webhook_url => "https://${::fqdn}:8088/payload",
44+
webhook_url => "https://${webhook_username}:${webhook_password}@${::fqdn}:8088/payload",
4245
token => hiera('gms_api_token'),
4346
project_name => 'puppet/control-repo',
4447
server_url => hiera('gms_server_url'),

site/profile/manifests/webhook_no_mcollective.pp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
class profile::webhook_no_mcollective {
1+
class profile::webhook_no_mcollective (
2+
$username,
3+
$password
4+
) {
25

36
class {'r10k::webhook::config':
47
enable_ssl => true,
5-
protected => false,
8+
protected => true,
9+
user => $username,
10+
pass => $password,
611
use_mcollective => false,
712
}
813

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
class role::all_in_one_pe {
22

3-
include profile::webhook_no_mcollective
4-
include profile::puppetmaster
3+
$webhook_username = hiera('webhook_username', fqdn_rand_string(10, '', 'username'))
4+
$webhook_password = hiera('webhook_password', fqdn_rand_string(20, '', 'password'))
5+
6+
class { 'profile::puppetmaster' :
7+
webhook_username => $webhook_username,
8+
webhook_password => $webhook_password,
9+
}
10+
11+
class { 'profile::webhook_no_mcollective' :
12+
username => $webhook_username,
13+
password => $webhook_password,
14+
}
515

616
}

0 commit comments

Comments
 (0)