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.
This commit is contained in:
Nick Walker 2015-10-30 13:04:42 -07:00
parent 3fcf6e3d5e
commit 8e271e3043
3 changed files with 24 additions and 6 deletions

View File

@ -1,4 +1,7 @@
class profile::puppetmaster { class profile::puppetmaster (
$webhook_username,
$webhook_password
) {
class { 'hiera': class { 'hiera':
hierarchy => [ hierarchy => [
@ -38,7 +41,7 @@ class profile::puppetmaster {
git_webhook { "web_post_receive_webhook-${::fqdn}" : git_webhook { "web_post_receive_webhook-${::fqdn}" :
ensure => present, ensure => present,
webhook_url => "https://${::fqdn}:8088/payload", webhook_url => "https://${webhook_username}:${webhook_password}@${::fqdn}:8088/payload",
token => hiera('gms_api_token'), token => hiera('gms_api_token'),
project_name => 'puppet/control-repo', project_name => 'puppet/control-repo',
server_url => hiera('gms_server_url'), server_url => hiera('gms_server_url'),

View File

@ -1,8 +1,13 @@
class profile::webhook_no_mcollective { class profile::webhook_no_mcollective (
$username,
$password
) {
class {'r10k::webhook::config': class {'r10k::webhook::config':
enable_ssl => true, enable_ssl => true,
protected => false, protected => true,
user => $username,
pass => $password,
use_mcollective => false, use_mcollective => false,
} }

View File

@ -1,6 +1,16 @@
class role::all_in_one_pe { class role::all_in_one_pe {
include profile::webhook_no_mcollective $webhook_username = hiera('webhook_username', fqdn_rand_string(10, '', 'username'))
include profile::puppetmaster $webhook_password = hiera('webhook_password', fqdn_rand_string(20, '', 'password'))
class { 'profile::puppetmaster' :
webhook_username => $webhook_username,
webhook_password => $webhook_password,
}
class { 'profile::webhook_no_mcollective' :
username => $webhook_username,
password => $webhook_password,
}
} }