3
0
Arne Teuke
2025-10-23 18:56:22 +02:00
parent 61fedb63a8
commit fe12537dda
6 changed files with 35 additions and 51 deletions

View File

@@ -13,27 +13,17 @@ class puppet_cd::r10k::webhook (
}
# create the webhook dir
file { '/opt/r10k-webhook':
file { $pt_r10k_webhook_dir:
ensure => directory,
path => $pt_r10k_webhook_dir,
owner => 'puppet',
group => 'puppet',
owner => 'root',
group => 'root',
mode => '0755',
selrange => s0,
selrole => object_r,
seltype => puppet_etc_t,
seltype => etc_t,
seluser => system_u,
}
# create the log file
file { '/var/log/r10k-webhook.log':
ensure => file,
owner => 'puppet',
group => 'puppet',
mode => '0644',
require => File['/opt/r10k-webhook'],
}
# create the requirements file
file { $pt_r10k_req_file:
ensure => file,
@@ -42,26 +32,26 @@ class puppet_cd::r10k::webhook (
mode => '0644',
selrange => s0,
selrole => object_r,
seltype => puppet_etc_t,
seltype => etc_t,
seluser => system_u,
content => template($pt_r10k_req_erb),
require => File['/var/log/r10k-webhook.log'],
}
# create the binary file
file { $pt_r10k_webhook_file:
# create the webhook config file
file { $pt_r10k_wh_config_file:
ensure => file,
owner => 'puppet',
group => 'puppet',
owner => 'root',
group => 'root',
mode => '0644',
selrange => s0,
selrole => object_r,
seltype => puppet_etc_t,
seltype => etc_t,
seluser => system_u,
content => template($pt_r10k_webhook_erb),
require => File['/opt/r10k-webhook'],
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',
@@ -78,26 +68,11 @@ class puppet_cd::r10k::webhook (
refreshonly => true,
}
# install systemd service file
file { $pt_r10k_wh_service_file:
ensure => file,
owner => 'root',
group => 'root',
mode => '0644',
selrange => s0,
selrole => object_r,
seltype => systemd_unit_file_t,
seluser => system_u,
content => template($pt_r10k_wh_service_erb),
notify => Exec['systemctl_daemon_reload'],
}
# manage service
service { 'r10k-webhook':
ensure => 'running',
enable => true,
require => File[$pt_r10k_wh_service_file],
subscribe => File[$pt_r10k_webhook_file],
subscribe => File[$pt_r10k_wh_config_file],
}
}
}