Recommit for updates in build 11
This commit is contained in:
@@ -1470,6 +1470,24 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
||||
<span class='name'>pt_r10k_webhook_pkg</span>
|
||||
|
||||
|
||||
<span class='type'>(<tt>String</tt>)</span>
|
||||
|
||||
|
||||
<em class="default">(defaults to: <tt>'python3-pip'</tt>)</em>
|
||||
|
||||
|
||||
—
|
||||
<div class='inline'>
|
||||
<p>the packages for the r10k webhook</p>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
||||
<span class='name'>pt_manage_user</span>
|
||||
@@ -1481,6 +1499,11 @@
|
||||
<em class="default">(defaults to: <tt>true</tt>)</em>
|
||||
|
||||
|
||||
—
|
||||
<div class='inline'>
|
||||
<p>whether to manage the puppet user</p>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
@@ -1494,8 +1517,6 @@
|
||||
<pre class="lines">
|
||||
|
||||
|
||||
86
|
||||
87
|
||||
88
|
||||
89
|
||||
90
|
||||
@@ -1648,10 +1669,18 @@
|
||||
237
|
||||
238
|
||||
239
|
||||
240</pre>
|
||||
240
|
||||
241
|
||||
242
|
||||
243
|
||||
244
|
||||
245
|
||||
246
|
||||
247
|
||||
248</pre>
|
||||
</td>
|
||||
<td>
|
||||
<pre class="code"><span class="info file"># File 'manifests/params.pp', line 86</span>
|
||||
<pre class="code"><span class="info file"># File 'manifests/params.pp', line 88</span>
|
||||
|
||||
class puppet_cd::params (
|
||||
|
||||
@@ -1665,6 +1694,7 @@ class puppet_cd::params (
|
||||
String $pt_server_pkg = 'puppetserver',
|
||||
Array $pt_db_pkg = ['puppetdb','puppetdb-termini'],
|
||||
Array $pt_r10k_pkg = ['ruby','ruby-devel','gcc','make','redhat-rpm-config','rpm-build'],
|
||||
String $pt_r10k_webhook_pkg = 'python3-pip',
|
||||
|
||||
# user settings
|
||||
## puppet user
|
||||
@@ -1770,6 +1800,7 @@ class puppet_cd::params (
|
||||
$pt_puppetdb_var_dir = '/opt/puppetlabs/server/data/puppetdb'
|
||||
## r10k
|
||||
$pt_r10k_dir = "${pt_main_dir}/r10k"
|
||||
$pt_r10k_webhook_dir = '/opt/r10k-webhook'
|
||||
|
||||
# files
|
||||
## puppet
|
||||
@@ -1798,6 +1829,10 @@ class puppet_cd::params (
|
||||
## r10k
|
||||
$pt_r10k_file = "${pt_r10k_dir}/r10k.yaml"
|
||||
$pt_r10k_erb = 'puppet_cd/r10k/r10k.yaml.erb'
|
||||
$pt_r10k_webhook_file = "${pt_r10k_webhook_dir}/webhook_server.py"
|
||||
$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'
|
||||
|
||||
# service
|
||||
$pt_server_service = 'puppetserver'
|
||||
|
||||
@@ -105,7 +105,61 @@
|
||||
7
|
||||
8
|
||||
9
|
||||
10</pre>
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
25
|
||||
26
|
||||
27
|
||||
28
|
||||
29
|
||||
30
|
||||
31
|
||||
32
|
||||
33
|
||||
34
|
||||
35
|
||||
36
|
||||
37
|
||||
38
|
||||
39
|
||||
40
|
||||
41
|
||||
42
|
||||
43
|
||||
44
|
||||
45
|
||||
46
|
||||
47
|
||||
48
|
||||
49
|
||||
50
|
||||
51
|
||||
52
|
||||
53
|
||||
54
|
||||
55
|
||||
56
|
||||
57
|
||||
58
|
||||
59
|
||||
60
|
||||
61
|
||||
62
|
||||
63
|
||||
64</pre>
|
||||
</td>
|
||||
<td>
|
||||
<pre class="code"><span class="info file"># File 'manifests/r10k/webhook.pp', line 6</span>
|
||||
@@ -113,7 +167,61 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
}</pre>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user