From dd4d4a9d9d26c22b3600ff459b292ba6840daab4 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Wed, 6 Sep 2017 14:16:34 +0200 Subject: Added php56 management for nagios policies --- services/applications.cf | 1 + services/applications/nagios.cf | 2 +- services/applications/php56.cf | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 services/applications/php56.cf (limited to 'services') diff --git a/services/applications.cf b/services/applications.cf index 6a5af1d..27ee499 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/php56.cf", "services/applications/sshd.cf", }; } diff --git a/services/applications/nagios.cf b/services/applications/nagios.cf index a664bb5..8e9ab44 100644 --- a/services/applications/nagios.cf +++ b/services/applications/nagios.cf @@ -5,9 +5,9 @@ bundle agent nagios "packages" slist => { "nagios4", "nginx", - "php56", }; methods: nagios:: "nagios" usebundle => fcgiwrap("nagios", "www", "770"); + "nagios" usebundle => php56(); } diff --git a/services/applications/php56.cf b/services/applications/php56.cf new file mode 100644 index 0000000..5f96d25 --- /dev/null +++ b/services/applications/php56.cf @@ -0,0 +1,33 @@ +bundle agent php56 +{ + methods: + freebsd:: + "freebsd" usebundle => install_package("$(this.bundle)", "php56"); + "freebsd" usebundle => add_rc_conf_line("$(this.bundle)", "php_fpm_enable=\"YES\""); + files: + freebsd:: + "/usr/local/etc/php.ini" + link_from => ln_s("/usr/local/etc/php.ini-production"), + move_obstructions => "true", + classes => if_repaired("php56_php_ini_file_repaired"); + "/usr/local/etc/php-fpm.conf" + create => "true", + edit_defaults => empty, + perms => system_owned("444"), + edit_template => "$(sys.inputdir)/templates/php/freebsd-php56-php-fpm.conf", + classes => if_repaired("php56_php_fpm_conf_file_repaired"); + classes: + freebsd:: + "php_fpm_service_running" expression => returnszero("/usr/sbin/service php-fpm status", "noshell"); + commands: + freebsd.!php_fpm_service_running:: + "/usr/sbin/service php-fpm start" classes => if_repaired("php_fpm_service_repaired"); + freebsd.(php56_php_fpm_conf_file_repaired|php56_php_ini_file_repaired):: + "/usr/sbin/service php-fpm restart" classes => if_repaired("php_fpm_service_restarted"); + reports: + any:: + "$(this.bundle): /usr/local/etc/php.ini repaired" ifvarclass => "php56_php_ini_file_repaired"; + "$(this.bundle): /usr/local/etc/php-fpm.conf repaired" ifvarclass => "php56_php_fpm_conf_file_repaired"; + "$(this.bundle): sshd service repaired" ifvarclass => "php_fpm_service_repaired"; + "$(this.bundle): sshd service restarted" ifvarclass => "php_fpm_service_restarted"; +} -- cgit v1.2.3