Refactor puppetmaster and zack_r10k_webhook
Moved the webhook resource out of puppetmaster and into zack_r10k to support exchaning code_manager in place of zack_r10k As a result I cleaned up some unnecessary parameters. Installing both the r10k webhook and the code_manager at this time for testing
This commit is contained in:
parent
4c2be74083
commit
2d7a9a72e1
@ -1,7 +1,4 @@
|
|||||||
class profile::puppetmaster (
|
class profile::puppetmaster {
|
||||||
$webhook_username,
|
|
||||||
$webhook_password
|
|
||||||
) {
|
|
||||||
|
|
||||||
class { 'hiera':
|
class { 'hiera':
|
||||||
hierarchy => [
|
hierarchy => [
|
||||||
@ -28,28 +25,18 @@ class profile::puppetmaster (
|
|||||||
$git_management_system = hiera('git_management_system', undef)
|
$git_management_system = hiera('git_management_system', undef)
|
||||||
$gms_api_token = hiera('gms_api_token', undef)
|
$gms_api_token = hiera('gms_api_token', undef)
|
||||||
|
|
||||||
if $git_management_system in ['gitlab', 'github'] {
|
if !empty($gms_api_token) {
|
||||||
|
|
||||||
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 => $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}" :
|
|
||||||
ensure => present,
|
|
||||||
webhook_url => "https://${webhook_username}:${webhook_password}@${::fqdn}:8088/payload",
|
|
||||||
token => hiera('gms_api_token'),
|
|
||||||
project_name => 'puppet/control-repo',
|
|
||||||
server_url => hiera('gms_server_url'),
|
|
||||||
provider => $git_management_system,
|
|
||||||
disable_ssl_verify => true,
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#END - Add deploy key and webhook to git management system
|
#END - Add deploy key and webhook to git management system
|
||||||
|
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
class profile::zack_r10k_webhook (
|
class profile::zack_r10k_webhook (
|
||||||
$username,
|
|
||||||
$password,
|
|
||||||
$use_mcollective = false,
|
$use_mcollective = false,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
$username = hiera('webhook_username', fqdn_rand_string(10, '', 'username'))
|
||||||
|
$password = hiera('webhook_password', fqdn_rand_string(20, '', 'password'))
|
||||||
|
|
||||||
|
$gms_api_token = hiera('gms_api_token', undef)
|
||||||
|
$git_management_system = hiera('git_management_system', undef)
|
||||||
|
|
||||||
if $use_mcollective {
|
if $use_mcollective {
|
||||||
|
|
||||||
class { 'r10k::mcollective':
|
class { 'r10k::mcollective':
|
||||||
|
@ -1,16 +1,7 @@
|
|||||||
class role::all_in_one_pe {
|
class role::all_in_one_pe {
|
||||||
|
|
||||||
$webhook_username = hiera('webhook_username', fqdn_rand_string(10, '', 'username'))
|
include profile::puppetmaster
|
||||||
$webhook_password = hiera('webhook_password', fqdn_rand_string(20, '', 'password'))
|
include profile::zack_r10k_webhook
|
||||||
|
include profile::code_manager
|
||||||
class { 'profile::puppetmaster' :
|
|
||||||
webhook_username => $webhook_username,
|
|
||||||
webhook_password => $webhook_password,
|
|
||||||
}
|
|
||||||
|
|
||||||
class { 'profile::zack_r10k_webhook' :
|
|
||||||
username => $webhook_username,
|
|
||||||
password => $webhook_password,
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user