Compare commits
8 Commits
9f7f93bfe1
...
9a6bd98633
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a6bd98633 | ||
|
|
702b868d0e | ||
| 1a3fdc24fd | |||
| 94042d4eb7 | |||
| 0108bba166 | |||
| 2272d2b87d | |||
| 13b3065dbd | |||
|
|
75367a1616 |
128
Jenkinsfile
vendored
128
Jenkinsfile
vendored
@@ -1,128 +0,0 @@
|
||||
pipeline {
|
||||
agent {
|
||||
label 'puppet'
|
||||
}
|
||||
|
||||
post {
|
||||
always {
|
||||
deleteDir() /* clean up our workspace */
|
||||
}
|
||||
success {
|
||||
updateGitlabCommitStatus state: 'success'
|
||||
}
|
||||
failure {
|
||||
updateGitlabCommitStatus state: 'failed'
|
||||
step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'support@confdroid.com', sendToIndividuals: true])
|
||||
}
|
||||
}
|
||||
|
||||
options {
|
||||
gitLabConnection('gitlab.confdroid.com')
|
||||
}
|
||||
|
||||
stages {
|
||||
|
||||
stage('pull master') {
|
||||
steps {
|
||||
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
|
||||
sh '''
|
||||
git config user.name "Jenkins Server"
|
||||
git config user.email jenkins@confdroid.com
|
||||
# Ensure we're on the development branch (triggered by push)
|
||||
git checkout development
|
||||
# Create jenkins branch from development
|
||||
git checkout -b jenkins-build-$BUILD_NUMBER
|
||||
# Optionally merge master into jenkins to ensure compatibility
|
||||
git merge origin/master --no-ff || { echo "Merge conflict detected"; exit 1; }
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('puppet parser') {
|
||||
steps {
|
||||
sh '''for file in $(find . -iname \'*.pp\'); do
|
||||
/opt/puppetlabs/bin/puppet parser validate --color false --render-as s --modulepath=modules $file || exit 1;
|
||||
done;'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('check templates') {
|
||||
steps{
|
||||
sh '''for file in $(find . -iname \'*.erb\');
|
||||
do erb -P -x -T "-" $file | ruby -c || exit 1;
|
||||
done;'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('puppet-lint') {
|
||||
steps {
|
||||
sh '''/usr/local/bin/puppet-lint . \\
|
||||
--no-variable_scope-check \\
|
||||
|| { echo "Puppet lint failed"; exit 1; }
|
||||
'''
|
||||
}
|
||||
}
|
||||
|
||||
stage('SonarScan') {
|
||||
steps {
|
||||
withCredentials([string(credentialsId: 'sonar-token', variable: 'SONAR_TOKEN')]) {
|
||||
sh '''
|
||||
/opt/sonar-scanner/bin/sonar-scanner \
|
||||
-Dsonar.projectKey=confdroid_puppet \
|
||||
-Dsonar.sources=. \
|
||||
-Dsonar.host.url=https://sonarqube.confdroid.com \
|
||||
-Dsonar.token=$SONAR_TOKEN
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('create Puppet documentation') {
|
||||
steps {
|
||||
sh '/opt/puppetlabs/bin/puppet strings'
|
||||
}
|
||||
}
|
||||
|
||||
stage('update repo') {
|
||||
steps {
|
||||
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
|
||||
sh '''
|
||||
git config user.name "Jenkins Server"
|
||||
git config user.email jenkins@confdroid.com
|
||||
git rm -r --cached .vscode || echo "No .vscode to remove from git"
|
||||
git add -A && git commit -am "Recommit for updates in build $BUILD_NUMBER" || echo "No changes to commit"
|
||||
git push origin HEAD:master
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Mirror to Gitea') {
|
||||
steps {
|
||||
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
|
||||
withCredentials([usernamePassword(
|
||||
credentialsId: 'Jenkins-gitea',
|
||||
usernameVariable: 'GITEA_USER',
|
||||
passwordVariable: 'GITEA_TOKEN')]) {
|
||||
script {
|
||||
// Checkout from GitLab (already done implicitly)
|
||||
sh '''
|
||||
git checkout master
|
||||
git pull origin master
|
||||
git branch -D development
|
||||
git branch -D jenkins-build-$BUILD_NUMBER
|
||||
git rm -f Jenkinsfile
|
||||
git rm -r --cached .vscode || echo "No .vscode to remove from git"
|
||||
git commit --amend --no-edit --allow-empty
|
||||
git remote add master https://sourcecode.confdroid.com/confdroid/confdroid_puppet.git
|
||||
git -c credential.helper="!f() { echo username=${GITEA_USER}; echo password=${GITEA_TOKEN}; }; f" \
|
||||
push master --mirror
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,7 @@ This module is also designed to work with [Foreman][def] as External Node Class
|
||||
### Directories, Files and Services
|
||||
|
||||
- manage directories and required files including
|
||||
permissions and selinux context (todo)
|
||||
permissions and selinux context
|
||||
- start services as required
|
||||
|
||||
### Optional
|
||||
|
||||
@@ -98,6 +98,11 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<span class='object_link'><a href="puppet_classes/confdroid_puppet_3A_3Amonitoring_3A_3Atarget.html" title="puppet_classes::confdroid_puppet::monitoring::target (puppet_class)">confdroid_puppet::monitoring::target</a></span>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<span class='object_link'><a href="puppet_classes/confdroid_puppet_3A_3Aparams.html" title="puppet_classes::confdroid_puppet::params (puppet_class)">confdroid_puppet::params</a></span>
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
|
||||
<h3 id="label-Directories-2C+Files+and+Services">Directories, Files and Services</h3>
|
||||
<ul><li>
|
||||
<p>manage directories and required files including permissions and selinux context (todo)</p>
|
||||
<p>manage directories and required files including permissions and selinux context</p>
|
||||
</li><li>
|
||||
<p>start services as required</p>
|
||||
</li></ul>
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
|
||||
<h3 id="label-Directories-2C+Files+and+Services">Directories, Files and Services</h3>
|
||||
<ul><li>
|
||||
<p>manage directories and required files including permissions and selinux context (todo)</p>
|
||||
<p>manage directories and required files including permissions and selinux context</p>
|
||||
</li><li>
|
||||
<p>start services as required</p>
|
||||
</li></ul>
|
||||
|
||||
@@ -78,35 +78,42 @@
|
||||
</li>
|
||||
|
||||
|
||||
<li id="object_puppet_classes::confdroid_puppet::params" class="odd">
|
||||
<li id="object_puppet_classes::confdroid_puppet::monitoring::target" class="odd">
|
||||
<div class="item">
|
||||
<span class='object_link'><a href="puppet_classes/confdroid_puppet_3A_3Amonitoring_3A_3Atarget.html" title="puppet_classes::confdroid_puppet::monitoring::target (puppet_class)">confdroid_puppet::monitoring::target</a></span>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li id="object_puppet_classes::confdroid_puppet::params" class="even">
|
||||
<div class="item">
|
||||
<span class='object_link'><a href="puppet_classes/confdroid_puppet_3A_3Aparams.html" title="puppet_classes::confdroid_puppet::params (puppet_class)">confdroid_puppet::params</a></span>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li id="object_puppet_classes::confdroid_puppet::puppetdb::dirs" class="even">
|
||||
<li id="object_puppet_classes::confdroid_puppet::puppetdb::dirs" class="odd">
|
||||
<div class="item">
|
||||
<span class='object_link'><a href="puppet_classes/confdroid_puppet_3A_3Apuppetdb_3A_3Adirs.html" title="puppet_classes::confdroid_puppet::puppetdb::dirs (puppet_class)">confdroid_puppet::puppetdb::dirs</a></span>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li id="object_puppet_classes::confdroid_puppet::puppetdb::files" class="odd">
|
||||
<li id="object_puppet_classes::confdroid_puppet::puppetdb::files" class="even">
|
||||
<div class="item">
|
||||
<span class='object_link'><a href="puppet_classes/confdroid_puppet_3A_3Apuppetdb_3A_3Afiles.html" title="puppet_classes::confdroid_puppet::puppetdb::files (puppet_class)">confdroid_puppet::puppetdb::files</a></span>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li id="object_puppet_classes::confdroid_puppet::r10k::install" class="even">
|
||||
<li id="object_puppet_classes::confdroid_puppet::r10k::install" class="odd">
|
||||
<div class="item">
|
||||
<span class='object_link'><a href="puppet_classes/confdroid_puppet_3A_3Ar10k_3A_3Ainstall.html" title="puppet_classes::confdroid_puppet::r10k::install (puppet_class)">confdroid_puppet::r10k::install</a></span>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
||||
<li id="object_puppet_classes::confdroid_puppet::server::service" class="odd">
|
||||
<li id="object_puppet_classes::confdroid_puppet::server::service" class="even">
|
||||
<div class="item">
|
||||
<span class='object_link'><a href="puppet_classes/confdroid_puppet_3A_3Aserver_3A_3Aservice.html" title="puppet_classes::confdroid_puppet::server::service (puppet_class)">confdroid_puppet::server::service</a></span>
|
||||
</div>
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
<div class="docstring">
|
||||
<div class="discussion">
|
||||
|
||||
<p>confdroid_puppet::main::config.pp Module name: confdroid_puppet Author: Arne Teuke (arne_teuke@confdroid)</p>
|
||||
<p>confdroid_puppet::main::config.pp Module name: confdroid_puppet Author: 12ww1160 (12ww1160@confdroid.com)</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -109,7 +109,11 @@
|
||||
11
|
||||
12
|
||||
13
|
||||
14</pre>
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18</pre>
|
||||
</td>
|
||||
<td>
|
||||
<pre class="code"><span class="info file"># File 'manifests/main/config.pp', line 6</span>
|
||||
@@ -122,6 +126,10 @@ class confdroid_puppet::main::config (
|
||||
if $pt_use_r10k == true {
|
||||
include confdroid_puppet::r10k::install
|
||||
}
|
||||
|
||||
if $pt_manage_nagios == true {
|
||||
include confdroid_puppet::monitoring::target
|
||||
}
|
||||
}</pre>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
<div class="docstring">
|
||||
<div class="discussion">
|
||||
|
||||
<p>confdroid_puppet::main::dirs.pp Module name: confdroid_puppet Author: Arne Teuke (arne_teuke@confdroid)</p>
|
||||
<p>confdroid_puppet::main::dirs.pp Module name: confdroid_puppet Author: 12ww1160 (12ww1160@confdroid.com)</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -133,7 +133,31 @@
|
||||
35
|
||||
36
|
||||
37
|
||||
38</pre>
|
||||
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</pre>
|
||||
</td>
|
||||
<td>
|
||||
<pre class="code"><span class="info file"># File 'manifests/main/dirs.pp', line 6</span>
|
||||
@@ -168,7 +192,31 @@ class confdroid_puppet::main::dirs (
|
||||
}
|
||||
|
||||
if $fqdn == $pt_pm_fqdn {
|
||||
# server dirs here
|
||||
# puppetserver dir
|
||||
file { $pt_server_dir:
|
||||
ensure => directory,
|
||||
path => $pt_server_dir,
|
||||
owner => 'puppet',
|
||||
group => 'puppet',
|
||||
mode => '0750',
|
||||
selrange => s0,
|
||||
selrole => object_r,
|
||||
seltype => puppet_etc_t,
|
||||
seluser => system_u,
|
||||
}
|
||||
|
||||
# code dir
|
||||
file { $pt_code_dir:
|
||||
ensure => directory,
|
||||
path => $pt_code_dir,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0755',
|
||||
selrange => s0,
|
||||
selrole => object_r,
|
||||
seltype => puppet_etc_t,
|
||||
seluser => system_u,
|
||||
}
|
||||
}
|
||||
}</pre>
|
||||
</td>
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>
|
||||
Puppet Class: confdroid_puppet::monitoring::target
|
||||
|
||||
— Documentation by YARD 0.9.36
|
||||
|
||||
</title>
|
||||
|
||||
<link rel="stylesheet" href="../css/style.css" type="text/css" />
|
||||
|
||||
<link rel="stylesheet" href="../css/common.css" type="text/css" />
|
||||
|
||||
<script type="text/javascript">
|
||||
pathId = "puppet_classes::confdroid_puppet::monitoring::target";
|
||||
relpath = '../';
|
||||
</script>
|
||||
|
||||
|
||||
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
||||
|
||||
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="nav_wrap">
|
||||
<iframe id="nav" src="../puppet_class_list.html?1"></iframe>
|
||||
<div id="resizer"></div>
|
||||
</div>
|
||||
|
||||
<div id="main" tabindex="-1">
|
||||
<div id="header">
|
||||
<div id="menu">
|
||||
|
||||
<a href="../_index.html">Index (c)</a> »
|
||||
<span class='title'><span class='object_link'>Puppet Classes</span></span>
|
||||
»
|
||||
<span class="title">confdroid_puppet::monitoring::target</span>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="search">
|
||||
|
||||
<a class="full_list_link" id="puppet_class_list_link"
|
||||
href="../puppet_class_list.html">
|
||||
|
||||
<svg width="24" height="24">
|
||||
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
||||
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
||||
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
||||
</svg>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
<div id="content"><h1>Puppet Class: confdroid_puppet::monitoring::target</h1>
|
||||
<div class="box_info">
|
||||
|
||||
<dl>
|
||||
<dt>Inherits:</dt>
|
||||
<dd><span class='object_link'><a href="confdroid_puppet_3A_3Aparams.html" title="puppet_classes::confdroid_puppet::params (puppet_class)">confdroid_puppet::params</a></span></dd>
|
||||
</dl>
|
||||
|
||||
|
||||
<dl>
|
||||
<dt>Defined in:</dt>
|
||||
<dd>
|
||||
manifests/monitoring/target.pp
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<h2>Summary</h2>
|
||||
class manages exports for nagios monitoring
|
||||
|
||||
<h2>Overview</h2>
|
||||
<div class="docstring">
|
||||
<div class="discussion">
|
||||
|
||||
<p>confdroid_puppet::monitoring::target.pp Module name: confdroid_puppet Author: 12ww1160 (12ww1160@puppetsoft.com)</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="tags">
|
||||
|
||||
|
||||
|
||||
</div><div class="method_details_list">
|
||||
<table class="source_code">
|
||||
<tr>
|
||||
<td>
|
||||
<pre class="lines">
|
||||
|
||||
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23</pre>
|
||||
</td>
|
||||
<td>
|
||||
<pre class="code"><span class="info file"># File 'manifests/monitoring/target.pp', line 6</span>
|
||||
|
||||
class confdroid_puppet::monitoring::target (
|
||||
|
||||
) inherits confdroid_puppet::params {
|
||||
if $pt_manage_nagios == true {
|
||||
@@nagios_service { "check_puppet_${fqdn}":
|
||||
check_command => "check_nrpe!check_puppet!${pt_procs_allowed}!puppet",
|
||||
use => 'generic-service',
|
||||
host_name => $fqdn,
|
||||
notification_period => '24x7',
|
||||
service_description => "${fqdn}_check_puppet",
|
||||
target => $pt_target_service,
|
||||
owner => 'nagios',
|
||||
group => 'nagios',
|
||||
mode => '0640',
|
||||
contacts => $pt_target_contacts,
|
||||
}
|
||||
}
|
||||
}</pre>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
Generated by <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>.
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -85,6 +85,8 @@
|
||||
|
||||
<span class='object_link'><a href="confdroid_puppet_3A_3Afirewall_3A_3Aiptables.html" title="puppet_classes::confdroid_puppet::firewall::iptables (puppet_class)">confdroid_puppet::firewall::iptables</a></span><br/>
|
||||
|
||||
<span class='object_link'><a href="confdroid_puppet_3A_3Amonitoring_3A_3Atarget.html" title="puppet_classes::confdroid_puppet::monitoring::target (puppet_class)">confdroid_puppet::monitoring::target</a></span><br/>
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
@@ -1194,6 +1196,73 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
||||
<span class='name'>pt_manage_nagios</span>
|
||||
|
||||
|
||||
<span class='type'>(<tt>Boolean</tt>)</span>
|
||||
|
||||
|
||||
<em class="default">(defaults to: <tt>false</tt>)</em>
|
||||
|
||||
|
||||
—
|
||||
<div class='inline'>
|
||||
<p>whether to manage nagios settings</p>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
||||
<span class='name'>pt_target_service</span>
|
||||
|
||||
|
||||
<span class='type'>(<tt>String</tt>)</span>
|
||||
|
||||
|
||||
<em class="default">(defaults to: <tt>'/etc/nagios/conf.d/puppet_service.cfg'</tt>)</em>
|
||||
|
||||
|
||||
—
|
||||
<div class='inline'>
|
||||
<p>the nagios service config file</p>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
||||
<span class='name'>pt_target_contacts</span>
|
||||
|
||||
|
||||
<span class='type'>(<tt>Array</tt>)</span>
|
||||
|
||||
|
||||
<em class="default">(defaults to: <tt>['nagiosadmin']</tt>)</em>
|
||||
|
||||
|
||||
—
|
||||
<div class='inline'>
|
||||
<p>the nagios contacts to notify</p>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
<li>
|
||||
|
||||
<span class='name'>pt_procs_allowed</span>
|
||||
|
||||
|
||||
<span class='type'>(<tt>String</tt>)</span>
|
||||
|
||||
|
||||
<em class="default">(defaults to: <tt>'1:'</tt>)</em>
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
@@ -1205,9 +1274,6 @@
|
||||
<pre class="lines">
|
||||
|
||||
|
||||
69
|
||||
70
|
||||
71
|
||||
72
|
||||
73
|
||||
74
|
||||
@@ -1358,10 +1424,20 @@
|
||||
219
|
||||
220
|
||||
221
|
||||
222</pre>
|
||||
222
|
||||
223
|
||||
224
|
||||
225
|
||||
226
|
||||
227
|
||||
228
|
||||
229
|
||||
230
|
||||
231
|
||||
232</pre>
|
||||
</td>
|
||||
<td>
|
||||
<pre class="code"><span class="info file"># File 'manifests/params.pp', line 69</span>
|
||||
<pre class="code"><span class="info file"># File 'manifests/params.pp', line 72</span>
|
||||
|
||||
class confdroid_puppet::params (
|
||||
|
||||
@@ -1438,6 +1514,12 @@ class confdroid_puppet::params (
|
||||
String $pt_r10k_basedir = '/etc/puppetlabs/code/environments',
|
||||
String $pt_r10k_webhook_port = '8085',
|
||||
|
||||
# nagios
|
||||
Boolean $pt_manage_nagios = false,
|
||||
String $pt_target_service = '/etc/nagios/conf.d/puppet_service.cfg',
|
||||
Array $pt_target_contacts = ['nagiosadmin'],
|
||||
String $pt_procs_allowed = '1:'
|
||||
|
||||
) {
|
||||
# facts
|
||||
$fqdn = $facts['networking']['fqdn']
|
||||
@@ -1450,6 +1532,7 @@ class confdroid_puppet::params (
|
||||
$pt_main_dir = '/etc/puppetlabs'
|
||||
$pt_puppetdir = "${pt_main_dir}/puppet"
|
||||
$pt_code_dir = "${pt_main_dir}/code"
|
||||
$pt_server_dir = "${pt_main_dir}/puppetserver"
|
||||
$pt_environmentspath = "${pt_code_dir}/environments"
|
||||
$pt_ssldir = "${pt_puppetdir}/ssl"
|
||||
$pt_privatekeydir = "${pt_ssldir}/private_keys"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## confdroid_puppet::main::config.pp
|
||||
# Module name: confdroid_puppet
|
||||
# Author: Arne Teuke (arne_teuke@confdroid)
|
||||
# Author: 12ww1160 (12ww1160@confdroid.com)
|
||||
# @summary Class manages main logic for the confdroid_puppet module.
|
||||
###############################################################################
|
||||
class confdroid_puppet::main::config (
|
||||
@@ -11,4 +11,8 @@ class confdroid_puppet::main::config (
|
||||
if $pt_use_r10k == true {
|
||||
include confdroid_puppet::r10k::install
|
||||
}
|
||||
|
||||
if $pt_manage_nagios == true {
|
||||
include confdroid_puppet::monitoring::target
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## confdroid_puppet::main::dirs.pp
|
||||
# Module name: confdroid_puppet
|
||||
# Author: Arne Teuke (arne_teuke@confdroid)
|
||||
# Author: 12ww1160 (12ww1160@confdroid.com)
|
||||
# @summary Class manages directories for the confdroid_puppet module.
|
||||
###############################################################################
|
||||
class confdroid_puppet::main::dirs (
|
||||
@@ -45,5 +45,18 @@ class confdroid_puppet::main::dirs (
|
||||
seltype => puppet_etc_t,
|
||||
seluser => system_u,
|
||||
}
|
||||
|
||||
# code dir
|
||||
file { $pt_code_dir:
|
||||
ensure => directory,
|
||||
path => $pt_code_dir,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
mode => '0755',
|
||||
selrange => s0,
|
||||
selrole => object_r,
|
||||
seltype => puppet_etc_t,
|
||||
seluser => system_u,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
23
manifests/monitoring/target.pp
Normal file
23
manifests/monitoring/target.pp
Normal file
@@ -0,0 +1,23 @@
|
||||
## confdroid_puppet::monitoring::target.pp
|
||||
# Module name: confdroid_puppet
|
||||
# Author: 12ww1160 (12ww1160@puppetsoft.com)
|
||||
# @summary class manages exports for nagios monitoring
|
||||
##############################################################################
|
||||
class confdroid_puppet::monitoring::target (
|
||||
|
||||
) inherits confdroid_puppet::params {
|
||||
if $pt_manage_nagios == true {
|
||||
@@nagios_service { "check_puppet_${fqdn}":
|
||||
check_command => "check_nrpe!check_puppet!${pt_procs_allowed}!puppet",
|
||||
use => 'generic-service',
|
||||
host_name => $fqdn,
|
||||
notification_period => '24x7',
|
||||
service_description => "${fqdn}_check_puppet",
|
||||
target => $pt_target_service,
|
||||
owner => 'nagios',
|
||||
group => 'nagios',
|
||||
mode => '0640',
|
||||
contacts => $pt_target_contacts,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -65,6 +65,9 @@
|
||||
# @param [String] pt_pptdb_server_crt placeholder for the server.crt
|
||||
# @param [String] pt_pptdb_server_key placeholder for the server.crt
|
||||
# @param [String] pt_pptdb_log_max_age the max age for puppetdb logs in days
|
||||
# @param [Boolean] pt_manage_nagios whether to manage nagios settings
|
||||
# @param [String] pt_target_service the nagios service config file
|
||||
# @param [Array] pt_target_contacts the nagios contacts to notify
|
||||
###############################################################################
|
||||
class confdroid_puppet::params (
|
||||
|
||||
@@ -141,6 +144,12 @@ class confdroid_puppet::params (
|
||||
String $pt_r10k_basedir = '/etc/puppetlabs/code/environments',
|
||||
String $pt_r10k_webhook_port = '8085',
|
||||
|
||||
# nagios
|
||||
Boolean $pt_manage_nagios = false,
|
||||
String $pt_target_service = '/etc/nagios/conf.d/puppet_service.cfg',
|
||||
Array $pt_target_contacts = ['nagiosadmin'],
|
||||
String $pt_procs_allowed = '1:'
|
||||
|
||||
) {
|
||||
# facts
|
||||
$fqdn = $facts['networking']['fqdn']
|
||||
|
||||
Reference in New Issue
Block a user