Skip to content

Commit 3149d97

Browse files
committed
Refactor webhook profiles into one profile with a parameter
Previously there was a mcollective and no_mcollective version of the webhook profile. They were almost identical so I merged them and manage the difference with a "use_mcollective" parameter. I renamed the webhook profile to zack_r10k_webhook.
1 parent 8e271e3 commit 3149d97

File tree

4 files changed

+24
-30
lines changed

4 files changed

+24
-30
lines changed

site/profile/manifests/puppetmaster.pp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,20 @@
2323
creates => $r10k_ssh_key_file,
2424
}
2525
#END - Generate an SSH key for r10k to connect to git
26-
26+
2727
#BEGIN - Add deploy key and webook to git management system
2828
$git_management_system = hiera('git_management_system', '')
2929

3030
if $git_management_system in ['gitlab', 'github'] {
31-
31+
3232
git_deploy_key { "add_deploy_key_to_puppet_control-${::fqdn}":
33-
ensure => present,
34-
name => $::fqdn,
35-
path => "${r10k_ssh_key_file}.pub",
36-
token => hiera('gms_api_token'),
37-
project_name => 'puppet/control-repo',
38-
server_url => hiera('gms_server_url'),
39-
provider => $git_management_system,
33+
ensure => present,
34+
name => $::fqdn,
35+
path => "${r10k_ssh_key_file}.pub",
36+
token => hiera('gms_api_token'),
37+
project_name => 'puppet/control-repo',
38+
server_url => hiera('gms_server_url'),
39+
provider => $git_management_system,
4040
}
4141

4242
git_webhook { "web_post_receive_webhook-${::fqdn}" :
@@ -57,11 +57,11 @@
5757
file { '/usr/local/bin/update-classes.sh' :
5858
ensure => file,
5959
source => 'puppet:///modules/profile/puppetmaster/update-classes.sh',
60-
mode => '755',
60+
mode => '0755',
6161
}
6262

6363
#https://docs.puppetlabs.com/puppet/latest/reference/config_file_environment.html#environmenttimeout
64-
ini_setting { "environment_timeout = unlimited":
64+
ini_setting { 'environment_timeout = unlimited':
6565
ensure => present,
6666
path => '/etc/puppetlabs/puppet/puppet.conf',
6767
section => 'main',

site/profile/manifests/webhook_mcollective.pp

Lines changed: 0 additions & 15 deletions
This file was deleted.

site/profile/manifests/webhook_no_mcollective.pp renamed to site/profile/manifests/zack_r10k_webhook.pp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
1-
class profile::webhook_no_mcollective (
1+
class profile::zack_r10k_webhook (
22
$username,
3-
$password
3+
$password,
4+
$use_mcollective = false,
45
) {
56

7+
if $use_mcollective {
8+
9+
class { 'r10k::mcollective':
10+
notify => Service['mcollective'],
11+
}
12+
13+
}
14+
615
class {'r10k::webhook::config':
716
enable_ssl => true,
817
protected => true,
918
user => $username,
1019
pass => $password,
11-
use_mcollective => false,
20+
use_mcollective => $use_mcollective,
1221
}
1322

1423
class {'r10k::webhook':

site/role/manifests/all_in_one_pe.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
webhook_password => $webhook_password,
99
}
1010

11-
class { 'profile::webhook_no_mcollective' :
11+
class { 'profile::zack_r10k_webhook' :
1212
username => $webhook_username,
1313
password => $webhook_password,
1414
}

0 commit comments

Comments
 (0)