3
0
This commit is contained in:
Arne Teuke
2025-10-23 20:18:11 +02:00
parent f8d861cbca
commit fc224074d2
5 changed files with 14 additions and 274 deletions

View File

@@ -7,72 +7,24 @@ 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 { $pt_r10k_webhook_dir:
ensure => directory,
# create the webhook binary
file { $pt_r10k_hook_file,
ensure => file,
owner => 'root',
group => 'root',
mode => '0755',
selrange => s0,
selrole => object_r,
seltype => etc_t,
seluser => system_u,
seltype => bin_t,
seluser => unconfined_u,
source => 'puppet:///module/puppet_cd/webhook',
}
# create the requirements file
file { $pt_r10k_req_file:
ensure => file,
owner => 'puppet',
group => 'puppet',
mode => '0644',
selrange => s0,
selrole => object_r,
seltype => etc_t,
seluser => system_u,
content => template($pt_r10k_req_erb),
}
# create the webhook config file
file { $pt_r10k_wh_config_file:
ensure => file,
owner => 'root',
group => 'root',
mode => '0644',
selrange => s0,
selrole => object_r,
seltype => etc_t,
seluser => system_u,
content => template($pt_r10k_wh_config_erb),
require => File[$pt_r10k_webhook_dir],
}
# 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
}
# establish exec systemd reload
exec { 'systemctl_daemon_reload':
command => 'systemctl daemon-reload',
path => ['/bin', '/usr/bin'],
require => Exec['pip_install_r10k_webhook'],
refreshonly => true,
}
# manage service
service { 'r10k-webhook':
ensure => 'running',
enable => true,
subscribe => File[$pt_r10k_wh_config_file],
}
# # manage service
# service { 'r10k-webhook':
# ensure => 'running',
# enable => true,
# subscribe => File[$pt_r10k_wh_config_file],
# }
}
}