update config file - https://gitlab.confdroid.com/internal/confdroid_management/-/issues/284
This commit is contained in:
@@ -84,6 +84,7 @@
|
|||||||
# @param [String] pt_r10k_basedir the base directory for r10k.yaml
|
# @param [String] pt_r10k_basedir the base directory for r10k.yaml
|
||||||
# @param [String] pt_r10k_webhook_pkg the packages for the r10k webhook
|
# @param [String] pt_r10k_webhook_pkg the packages for the r10k webhook
|
||||||
# @param [Boolean] pt_manage_user whether to manage the puppet user
|
# @param [Boolean] pt_manage_user whether to manage the puppet user
|
||||||
|
# @param [String] pt_webhook_secret the secret for the webhook
|
||||||
###############################################################################
|
###############################################################################
|
||||||
class puppet_cd::params (
|
class puppet_cd::params (
|
||||||
|
|
||||||
@@ -175,6 +176,7 @@ class puppet_cd::params (
|
|||||||
String $pt_r10k_remote = 'git@gitlab.example.net/repo.git',
|
String $pt_r10k_remote = 'git@gitlab.example.net/repo.git',
|
||||||
Boolean $pt_r10k_prefix = false,
|
Boolean $pt_r10k_prefix = false,
|
||||||
String $pt_r10k_basedir = '/etc/puppetlabs/code/environments',
|
String $pt_r10k_basedir = '/etc/puppetlabs/code/environments',
|
||||||
|
String $pt_webhook_secret = '',
|
||||||
|
|
||||||
) {
|
) {
|
||||||
# facts
|
# facts
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ class puppet_cd::r10k::webhook (
|
|||||||
seltype => etc_t,
|
seltype => etc_t,
|
||||||
seluser => system_u,
|
seluser => system_u,
|
||||||
content => template($pt_r10k_hook_config_erb),
|
content => template($pt_r10k_hook_config_erb),
|
||||||
|
notify => Service['webhook'],
|
||||||
}
|
}
|
||||||
|
|
||||||
# create service config
|
# create service config
|
||||||
@@ -54,15 +55,15 @@ class puppet_cd::r10k::webhook (
|
|||||||
seltype => systemd_unit_file_t,
|
seltype => systemd_unit_file_t,
|
||||||
seluser => system_u,
|
seluser => system_u,
|
||||||
content => template($pt_r10k_hook_service_erb),
|
content => template($pt_r10k_hook_service_erb),
|
||||||
|
notify => Service['webhook'],
|
||||||
}
|
}
|
||||||
|
|
||||||
# manage service
|
# manage service
|
||||||
service { 'r10k-webhook':
|
service { 'webhook':
|
||||||
ensure => 'running',
|
ensure => 'running',
|
||||||
hasstatus => true,
|
hasstatus => true,
|
||||||
hasrestart => true,
|
hasrestart => true,
|
||||||
enable => true,
|
enable => true,
|
||||||
subscribe => File[$pt_r10k_hook_service_file],
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
"trigger-rule": {
|
"trigger-rule": {
|
||||||
"match": {
|
"match": {
|
||||||
"type": "payload-hash-sha1",
|
"type": "payload-hash-sha1",
|
||||||
"secret": "your_webhook_secret"
|
"secret": "<%= @pt_webhook_secret %>"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"host": "<%= @pt_pm_fqdn %>",
|
|
||||||
"port": "8088",
|
|
||||||
"flush_env_cache": false,
|
|
||||||
"branch_to_env_map": {
|
|
||||||
"master": "production",
|
|
||||||
"^env_(.*)$": "\g<1>"
|
|
||||||
},
|
|
||||||
"allowed_branches": "^(env_[\w]+|master)$"
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user