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

View File

@ -23,20 +23,20 @@ class profile::puppetmaster (
creates => $r10k_ssh_key_file, creates => $r10k_ssh_key_file,
} }
#END - Generate an SSH key for r10k to connect to git #END - Generate an SSH key for r10k to connect to git
#BEGIN - Add deploy key and webook to git management system #BEGIN - Add deploy key and webook to git management system
$git_management_system = hiera('git_management_system', '') $git_management_system = hiera('git_management_system', '')
if $git_management_system in ['gitlab', 'github'] { if $git_management_system in ['gitlab', 'github'] {
git_deploy_key { "add_deploy_key_to_puppet_control-${::fqdn}": git_deploy_key { "add_deploy_key_to_puppet_control-${::fqdn}":
ensure => present, ensure => present,
name => $::fqdn, name => $::fqdn,
path => "${r10k_ssh_key_file}.pub", path => "${r10k_ssh_key_file}.pub",
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'),
provider => $git_management_system, provider => $git_management_system,
} }
git_webhook { "web_post_receive_webhook-${::fqdn}" : git_webhook { "web_post_receive_webhook-${::fqdn}" :
@ -57,11 +57,11 @@ class profile::puppetmaster (
file { '/usr/local/bin/update-classes.sh' : file { '/usr/local/bin/update-classes.sh' :
ensure => file, ensure => file,
source => 'puppet:///modules/profile/puppetmaster/update-classes.sh', source => 'puppet:///modules/profile/puppetmaster/update-classes.sh',
mode => '755', mode => '0755',
} }
#https://docs.puppetlabs.com/puppet/latest/reference/config_file_environment.html#environmenttimeout #https://docs.puppetlabs.com/puppet/latest/reference/config_file_environment.html#environmenttimeout
ini_setting { "environment_timeout = unlimited": ini_setting { 'environment_timeout = unlimited':
ensure => present, ensure => present,
path => '/etc/puppetlabs/puppet/puppet.conf', path => '/etc/puppetlabs/puppet/puppet.conf',
section => 'main', section => 'main',

View File

@ -1,15 +0,0 @@
class profile::webhook_mcollective {
class { 'r10k::mcollective':
notify => Service['mcollective'],
}
include r10k::webhook::config
class {'r10k::webhook':
user => 'root',
group => '0',
require => Class['r10k::webhook::config'],
}
}

View File

@ -1,14 +1,23 @@
class profile::webhook_no_mcollective ( class profile::zack_r10k_webhook (
$username, $username,
$password $password,
$use_mcollective = false,
) { ) {
if $use_mcollective {
class { 'r10k::mcollective':
notify => Service['mcollective'],
}
}
class {'r10k::webhook::config': class {'r10k::webhook::config':
enable_ssl => true, enable_ssl => true,
protected => true, protected => true,
user => $username, user => $username,
pass => $password, pass => $password,
use_mcollective => false, use_mcollective => $use_mcollective,
} }
class {'r10k::webhook': class {'r10k::webhook':

View File

@ -8,7 +8,7 @@ class role::all_in_one_pe {
webhook_password => $webhook_password, webhook_password => $webhook_password,
} }
class { 'profile::webhook_no_mcollective' : class { 'profile::zack_r10k_webhook' :
username => $webhook_username, username => $webhook_username,
password => $webhook_password, password => $webhook_password,
} }