summaryrefslogtreecommitdiff
path: root/services/applications
diff options
context:
space:
mode:
authorJulien Dessaux2017-09-19 17:55:40 +0200
committerJulien Dessaux2017-09-21 16:21:41 +0200
commit142820653f8d6a3fffacc9acde09ca74e22892bf (patch)
tree3518ffe3ca11318cd70b88c6ab8ff26b79ea45f1 /services/applications
parentFixed docker permissions for user julien (diff)
downloadmasterfiles-142820653f8d6a3fffacc9acde09ca74e22892bf.tar.gz
masterfiles-142820653f8d6a3fffacc9acde09ca74e22892bf.tar.bz2
masterfiles-142820653f8d6a3fffacc9acde09ca74e22892bf.zip
Finished adding nagios policy along with simple nginx policy
Diffstat (limited to '')
-rw-r--r--services/applications.cf1
-rw-r--r--services/applications/nagios.cf31
-rw-r--r--services/applications/nginx.cf33
3 files changed, 64 insertions, 1 deletions
diff --git a/services/applications.cf b/services/applications.cf
index 27ee499..c380374 100644
--- a/services/applications.cf
+++ b/services/applications.cf
@@ -5,6 +5,7 @@ body file control
"services/applications/check_mk.cf",
"services/applications/fcgiwrap.cf",
"services/applications/nagios.cf",
+ "services/applications/nginx.cf",
"services/applications/php56.cf",
"services/applications/sshd.cf",
};
diff --git a/services/applications/nagios.cf b/services/applications/nagios.cf
index 8e9ab44..ca37cbf 100644
--- a/services/applications/nagios.cf
+++ b/services/applications/nagios.cf
@@ -4,10 +4,39 @@ bundle agent nagios
nagios::
"packages" slist => {
"nagios4",
- "nginx",
+ "nagios-plugins",
};
methods:
nagios::
"nagios" usebundle => fcgiwrap("nagios", "www", "770");
"nagios" usebundle => php56();
+ "nagios" usebundle => nginx("$(sys.inputdir)/templates/nginx/nagios_nginx.conf", "nginx.conf");
+ "nagios" usebundle => nginx("$(sys.inputdir)/templates/nginx/nagios_htpasswd", "htpasswd");
+ "nagios" usebundle => install_package("$(this.bundle)", "$(nagios.packages)");
+ "nagios" usebundle => add_rc_conf_line("$(this.bundle)", "nagios_enable=\"YES\"");
+ files:
+ nagios::
+ "/usr/local/etc/nagios/."
+ create => "true",
+ depth_search => recurse("inf"),
+ perms => og("nagios", "nagios"),
+ copy_from => copyfrom_sync("$(sys.inputdir)/templates/nagios/"),
+ classes => if_repaired("nagios_nagios_dir_repaired");
+ classes:
+ nagios::
+ "nagios_service_running" expression => returnszero("/usr/sbin/service nagios status", "noshell");
+ methods:
+ nagios::
+ "freebsd" usebundle => add_rc_conf_line("$(this.bundle)", "nagios_enable=\"YES\"");
+ commands:
+ nagios.!nagios_service_running::
+ "/usr/sbin/service nagios start" classes => if_repaired("nagios_service_repaired");
+ nagios.nagios_nagios_dir_repaired::
+ "/usr/sbin/service nagios restart" classes => if_repaired("nagios_service_restarted");
+ reports:
+ any::
+ "$(this.bundle): /usr/local/etc/nagios/ directory repaired" ifvarclass => "nagios_nagios_dir_repaired";
+ "$(this.bundle): /usr/local/etc/nginx/htpasswd file repaired" ifvarclass => "nagios_htpasswd_file_repaired";
+ "$(this.bundle): nagios service repaired" ifvarclass => "nagios_service_repaired";
+ "$(this.bundle): nagios service restarted" ifvarclass => "nagios_service_restarted";
}
diff --git a/services/applications/nginx.cf b/services/applications/nginx.cf
new file mode 100644
index 0000000..ea74612
--- /dev/null
+++ b/services/applications/nginx.cf
@@ -0,0 +1,33 @@
+bundle agent nginx(source, destination)
+{
+ methods:
+ freebsd::
+ "freebsd" usebundle => install_package("$(this.bundle)", "nginx");
+ vars:
+ freebsd::
+ "repaired_conf_classes" slist => { "nginx_nginx_conf_$(destination)_file_repaired", "nginx_needs_restarting" };
+ files:
+ freebsd::
+ "/usr/local/etc/nginx/$(destination)"
+ create => "true",
+ edit_defaults => empty,
+ perms => system_owned("444"),
+ edit_template => "$(source)",
+ classes => if_repaired(@(repaired_conf_classes));
+ classes:
+ freebsd::
+ "nginx_service_running" expression => returnszero("/usr/sbin/service nginx status", "noshell");
+ methods:
+ freebsd::
+ "freebsd" usebundle => add_rc_conf_line("$(this.bundle)", "nginx_enable=\"YES\"");
+ commands:
+ freebsd.!nginx_service_running::
+ "/usr/sbin/service nginx start" classes => if_repaired("nginx_service_repaired");
+ freebsd.nginx_needs_restarting::
+ "/usr/sbin/service nginx restart" classes => if_repaired("nginx_service_restarted");
+ reports:
+ any::
+ "$(this.bundle): /usr/local/etc/nginx/$(destination) repaired" ifvarclass => "nginx_nginx_conf_$(destination)_file_repaired";
+ "$(this.bundle): nginx service repaired" ifvarclass => "nginx_service_repaired";
+ "$(this.bundle): nginx service restarted" ifvarclass => "nginx_service_restarted";
+}