3
0

add webhook sections

This commit is contained in:
Arne Teuke
2025-10-23 16:46:38 +02:00
parent acf1664073
commit b50be96b34
2 changed files with 62 additions and 0 deletions

View File

@@ -6,5 +6,59 @@
class puppet_cd::r10k::webhook (
) inherits puppet_cd::params {
if ($pt_pm_fqdn == $fqdn) and ($pt_use_r10k_webhook == true) {
# install packages
package { $pt_r10k_webhook_pkg:
ensure => $pt_pkg_ensure,
}
# create the webhook dir
file { '/opt/r10k-webhook':
ensure => directory,
path => $pt_r10k_webhook_dir,
owner => 'puppet',
group => 'puppet',
mode => '0755',
selrange => s0,
selrole => object_r,
seltype => puppet_etc_t,
seluser => system_u,
}
# create the requirements file
file { $pt_r10k_req_file:
ensure => file,
owner => 'puppet',
group => 'puppet',
mode => '0644',
selrange => s0,
selrole => object_r,
seltype => puppet_etc_t,
seluser => system_u,
content => template($pt_r10k_req_erb),
require => File['/opt/r10k-webhook'],
}
# create the binary file
file { $pt_r10k_webhook_file:
ensure => file,
owner => 'puppet',
group => 'puppet',
mode => '0644',
selrange => s0,
selrole => object_r,
seltype => puppet_etc_t,
seluser => system_u,
content => template($pt_r10k_webhook_erb),
require => File['/opt/r10k-webhook'],
}
# install pip dependencies
exec { 'pip_install_r10k_webhook':
command => 'pip3 install --user -r /opt/r10k-webhook/requirements.txt',
user => 'puppet',
require => [Package[$pt_r10k_webhook_pkg],File[$pt_r10k_req_file]],
unless => 'pip3 show fastapi', # Idempotent check
}
}
}