Merge branch 'jenkins-build-12' into 'master'
Auto-merge for build 12 See merge request puppet/puppet_cd!10
This commit is contained in:
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@@ -14,9 +14,11 @@
|
||||
"kahadb",
|
||||
"levelname",
|
||||
"logappender",
|
||||
"NOFILE",
|
||||
"pydantic",
|
||||
"pylint",
|
||||
"pytest",
|
||||
"refreshonly",
|
||||
"repolist",
|
||||
"requestlogging",
|
||||
"springframework",
|
||||
|
||||
@@ -139,7 +139,14 @@
|
||||
41
|
||||
42
|
||||
43
|
||||
44</pre>
|
||||
44
|
||||
45
|
||||
46
|
||||
47
|
||||
48
|
||||
49
|
||||
50
|
||||
51</pre>
|
||||
</td>
|
||||
<td>
|
||||
<pre class="code"><span class="info file"># File 'manifests/firewall/iptables.pp', line 6</span>
|
||||
@@ -158,6 +165,13 @@ class puppet_cd::firewall::iptables (
|
||||
dport => '8443',
|
||||
jump => 'accept',
|
||||
}
|
||||
if $pt_use_r10k_webhook == true {
|
||||
firewall { '38080 open port 8080':
|
||||
proto => 'tcp',
|
||||
dport => '8080',
|
||||
jump => 'accept',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if $fqdn == $pt_db_fqdn {
|
||||
|
||||
@@ -1677,7 +1677,10 @@
|
||||
245
|
||||
246
|
||||
247
|
||||
248</pre>
|
||||
248
|
||||
249
|
||||
250
|
||||
251</pre>
|
||||
</td>
|
||||
<td>
|
||||
<pre class="code"><span class="info file"># File 'manifests/params.pp', line 88</span>
|
||||
@@ -1833,11 +1836,14 @@ class puppet_cd::params (
|
||||
$pt_r10k_webhook_erb = 'puppet_cd/r10k/webhook.py.erb'
|
||||
$pt_r10k_req_file = "${pt_r10k_webhook_dir}/requirements.txt"
|
||||
$pt_r10k_req_erb = 'puppet_cd/r10k/requirements.txt.erb'
|
||||
$pt_r10k_wh_service_file = '/etc/systemd/system/r10k-webhook.service'
|
||||
$pt_r10k_wh_service_erb = 'puppet_cd/r10k/r10k_webhook_service.erb'
|
||||
|
||||
# service
|
||||
$pt_server_service = 'puppetserver'
|
||||
$pt_agent_service = 'puppet'
|
||||
$pt_db_service = 'puppetdb'
|
||||
$pt_r10k_wb_service = 'r10k-webhook'
|
||||
|
||||
#
|
||||
# includes must be last
|
||||
|
||||
@@ -159,7 +159,38 @@
|
||||
61
|
||||
62
|
||||
63
|
||||
64</pre>
|
||||
64
|
||||
65
|
||||
66
|
||||
67
|
||||
68
|
||||
69
|
||||
70
|
||||
71
|
||||
72
|
||||
73
|
||||
74
|
||||
75
|
||||
76
|
||||
77
|
||||
78
|
||||
79
|
||||
80
|
||||
81
|
||||
82
|
||||
83
|
||||
84
|
||||
85
|
||||
86
|
||||
87
|
||||
88
|
||||
89
|
||||
90
|
||||
91
|
||||
92
|
||||
93
|
||||
94
|
||||
95</pre>
|
||||
</td>
|
||||
<td>
|
||||
<pre class="code"><span class="info file"># File 'manifests/r10k/webhook.pp', line 6</span>
|
||||
@@ -221,6 +252,37 @@ class puppet_cd::r10k::webhook (
|
||||
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,
|
||||
}
|
||||
|
||||
# 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),
|
||||
require => Exec['systemctl_daemon_reload'],
|
||||
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],
|
||||
}
|
||||
}
|
||||
}</pre>
|
||||
</td>
|
||||
|
||||
@@ -17,6 +17,13 @@ class puppet_cd::firewall::iptables (
|
||||
dport => '8443',
|
||||
jump => 'accept',
|
||||
}
|
||||
if $pt_use_r10k_webhook == true {
|
||||
firewall { '38080 open port 8080':
|
||||
proto => 'tcp',
|
||||
dport => '8080',
|
||||
jump => 'accept',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if $fqdn == $pt_db_fqdn {
|
||||
|
||||
@@ -236,11 +236,14 @@ class puppet_cd::params (
|
||||
$pt_r10k_webhook_erb = 'puppet_cd/r10k/webhook.py.erb'
|
||||
$pt_r10k_req_file = "${pt_r10k_webhook_dir}/requirements.txt"
|
||||
$pt_r10k_req_erb = 'puppet_cd/r10k/requirements.txt.erb'
|
||||
$pt_r10k_wh_service_file = '/etc/systemd/system/r10k-webhook.service'
|
||||
$pt_r10k_wh_service_erb = 'puppet_cd/r10k/r10k_webhook_service.erb'
|
||||
|
||||
# service
|
||||
$pt_server_service = 'puppetserver'
|
||||
$pt_agent_service = 'puppet'
|
||||
$pt_db_service = 'puppetdb'
|
||||
$pt_r10k_wb_service = 'r10k-webhook'
|
||||
|
||||
#
|
||||
# includes must be last
|
||||
|
||||
@@ -60,5 +60,36 @@ class puppet_cd::r10k::webhook (
|
||||
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,
|
||||
}
|
||||
|
||||
# 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),
|
||||
require => Exec['systemctl_daemon_reload'],
|
||||
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],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
19
templates/r10k/r10k_webhook_service.erb
Normal file
19
templates/r10k/r10k_webhook_service.erb
Normal file
@@ -0,0 +1,19 @@
|
||||
[Unit]
|
||||
Description=r10k Webhook Server
|
||||
After=network.target haproxy.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=puppet
|
||||
Group=puppet
|
||||
WorkingDirectory=/opt/r10k-webhook
|
||||
ExecStart=/usr/bin/python3 /opt/r10k-webhook/webhook_server.py
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
Environment=R10K_WEBHOOK_SECRET=YOUR_SECRET_HERE
|
||||
LimitNOFILE=65536
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user