diff options
author | Julien Dessaux | 2017-08-27 23:31:08 +0200 |
---|---|---|
committer | Julien Dessaux | 2017-08-27 23:44:05 +0200 |
commit | 5f4f78d55d832d31639119804e7ff9f69ecdda41 (patch) | |
tree | 8fccfce99393da540053a5cb35f0ba30e30ec9d5 | |
parent | Added nagios server policy (diff) | |
download | masterfiles-5f4f78d55d832d31639119804e7ff9f69ecdda41.tar.gz masterfiles-5f4f78d55d832d31639119804e7ff9f69ecdda41.tar.bz2 masterfiles-5f4f78d55d832d31639119804e7ff9f69ecdda41.zip |
Updated usebundle system to include caller information un report
-rw-r--r-- | services/applications/bareos_fd.cf | 4 | ||||
-rw-r--r-- | services/applications/check_mk.cf | 2 | ||||
-rw-r--r-- | services/applications/fcgiwrap.cf | 17 | ||||
-rw-r--r-- | services/applications/nagios.cf | 2 | ||||
-rw-r--r-- | services/applications/sshd.cf | 2 | ||||
-rw-r--r-- | services/common.cf | 14 | ||||
-rw-r--r-- | services/julien.cf | 2 | ||||
-rw-r--r-- | services/main.cf | 2 | ||||
-rw-r--r-- | services/os.cf | 9 | ||||
-rw-r--r-- | services/os/debian.cf | 5 | ||||
-rw-r--r-- | services/os/freebsd.cf | 9 | ||||
-rw-r--r-- | services/os/ubuntu.cf | 5 |
12 files changed, 42 insertions, 31 deletions
diff --git a/services/applications/bareos_fd.cf b/services/applications/bareos_fd.cf index 3b16a91..9286c9a 100644 --- a/services/applications/bareos_fd.cf +++ b/services/applications/bareos_fd.cf @@ -16,8 +16,8 @@ bundle agent bareos_fd "bareos_fd_service_running" expression => returnszero("/usr/sbin/service bareos-fd status", "noshell"); methods: freebsd:: - "any" usebundle => install_package("$(bareos_fd.packages)"); - "any" usebundle => add_rc_conf_line("$(bareos_fd.rc_conf_lines)"); + "freebsd" usebundle => install_package("$(this.bundle)", "$(bareos_fd.packages)"); + "freebsd" usebundle => add_rc_conf_line("$(this.bundle)", "$(bareos_fd.rc_conf_lines)"); files: freebsd:: "/usr/local/etc/bareos/bareos-fd.d/client/myself.conf" diff --git a/services/applications/check_mk.cf b/services/applications/check_mk.cf index 0731eaa..8a1ce82 100644 --- a/services/applications/check_mk.cf +++ b/services/applications/check_mk.cf @@ -27,7 +27,7 @@ bundle agent check_mk "inetd_service_running" expression => returnszero("/usr/sbin/service inetd status", "noshell"); methods: freebsd:: - "any" usebundle => add_rc_conf_line("$(check_mk.rc_conf_lines)"); + "freebsd" usebundle => add_rc_conf_line("$(this.bundle)", "$(check_mk.rc_conf_lines)"); commands: freebsd.!inetd_service_running:: "/usr/sbin/service inetd start" classes => if_repaired("inet_service_repaired"); diff --git a/services/applications/fcgiwrap.cf b/services/applications/fcgiwrap.cf index 7c491c0..7c9c809 100644 --- a/services/applications/fcgiwrap.cf +++ b/services/applications/fcgiwrap.cf @@ -1,11 +1,16 @@ bundle agent fcgiwrap(user, group, mode) { + vars: + freebsd:: + "rc_conf_lines" slist => { + "fcgiwrap_enable=\"YES\"", + "fcgiwrap_user=\"$(user)\"", + "fcgiwrap_socket_mode=\"$(mode)\"", + "fcgiwrap_socket_owner=\"$(user)\"", + "fcgiwrap_socket_group=\"$(group)\"", + }; methods: freebsd:: - "any" usebundle => install_package("fcgiwrap"); - "any" usebundle => add_rc_conf_line("fcgiwrap_enable=\"YES\""); - "any" usebundle => add_rc_conf_line("fcgiwrap_user=\"$(user)\""); - "any" usebundle => add_rc_conf_line("fcgiwrap_mode=\"$(mode)\""); - "any" usebundle => add_rc_conf_line("fcgiwrap_owner=\"$(user)\""); - "any" usebundle => add_rc_conf_line("fcgiwrap_group=\"$(group)\""); + "freebsd" usebundle => install_package("$(this.bundle)", "fcgiwrap"); + "freebsd" usebundle => add_rc_conf_line("$(this.bundle)", "$(fcgiwrap.rc_conf_lines)"); } diff --git a/services/applications/nagios.cf b/services/applications/nagios.cf index 156fdfb..a664bb5 100644 --- a/services/applications/nagios.cf +++ b/services/applications/nagios.cf @@ -9,5 +9,5 @@ bundle agent nagios }; methods: nagios:: - "any" usebundle => fcgiwrap("nagios", "www", "770"); + "nagios" usebundle => fcgiwrap("nagios", "www", "770"); } diff --git a/services/applications/sshd.cf b/services/applications/sshd.cf index 1b5bca7..b3bfa33 100644 --- a/services/applications/sshd.cf +++ b/services/applications/sshd.cf @@ -17,7 +17,7 @@ bundle agent sshd "sshd_service_running" expression => returnszero("/usr/sbin/service sshd status", "noshell"); methods: freebsd:: - "any" usebundle => add_rc_conf_line("sshd_enable=\"YES\""); + "freebsd" usebundle => add_rc_conf_line("$(this.bundle)", "sshd_enable=\"YES\""); commands: freebsd.!sshd_service_running:: "/usr/sbin/service sshd start" classes => if_repaired("sshd_service_repaired"); diff --git a/services/common.cf b/services/common.cf index b5e7b75..8efeeaf 100644 --- a/services/common.cf +++ b/services/common.cf @@ -12,7 +12,7 @@ bundle agent common "$(this.bundle): /etc/hosts repaired" ifvarclass => "common_hosts_files_repaired"; } -bundle agent home_skel(user) +bundle agent home_skel(caller, user) { files: any:: @@ -20,26 +20,26 @@ bundle agent home_skel(user) create => "true", copy_from => seed_cp("/etc/skel"), depth_search => recurse("inf"), - classes => if_repaired("home_skel_$(user)_repaired"); + classes => if_repaired("$(caller)_home_skel_$(user)_repaired"); reports: any:: - "$(this.bundle): /home/$(user) initialized" ifvarclass => "home_skel_$(user)_repaired"; + "$(caller): /home/$(user) initialized" ifvarclass => "$(caller)_home_skel_$(user)_repaired"; } -bundle agent install_package(package) +bundle agent install_package(caller, package) { packages: debian|ubuntu:: "$(package)" policy => "present", package_module => apt_get, - classes => if_repaired("common_package_$(package)_add_repaired"); + classes => if_repaired("$(caller)_common_package_$(package)_add_repaired"); freebsd:: "$(package)" policy => "present", package_module => pkg, - classes => if_repaired("common_package_$(package)_add_repaired"); + classes => if_repaired("$(caller)_common_package_$(package)_add_repaired"); reports: any:: - "$(this.bundle): $(package) installed" ifvarclass => "common_package_$(package)_add_repaired"; + "$(caller): $(package) installed" ifvarclass => "$(caller)_common_package_$(package)_add_repaired"; } diff --git a/services/julien.cf b/services/julien.cf index bf21323..06a361b 100644 --- a/services/julien.cf +++ b/services/julien.cf @@ -34,7 +34,7 @@ bundle agent julien not => groupexists("julien"); methods: console_julien:: - "any" usebundle => install_package("$(julien.packages)"); + "console_julien" usebundle => install_package("$(this.bundle)", "$(julien.packages)"); commands: group_julien_absent:: "$(group_command)" diff --git a/services/main.cf b/services/main.cf index e861bf4..d5e52bb 100644 --- a/services/main.cf +++ b/services/main.cf @@ -35,5 +35,5 @@ bundle agent classify "mail_servers" or => { "legend" }; methods: nagios:: - "any" usebundle => nagios; + "nagios" usebundle => nagios; } diff --git a/services/os.cf b/services/os.cf index ee8dc65..25eb203 100644 --- a/services/os.cf +++ b/services/os.cf @@ -11,12 +11,9 @@ bundle agent os { methods: debian:: - "any" usebundle => install_package("$(debian.packages)"); - "any" usebundle => debian; + "debian" usebundle => debian; freebsd:: - "any" usebundle => install_package("$(freebsd.packages)"); - "any" usebundle => freebsd; + "freebsd" usebundle => freebsd; ubuntu:: - "any" usebundle => install_package("$(ubuntu.packages)"); - "any" usebundle => ubuntu; + "ubuntu" usebundle => ubuntu; } diff --git a/services/os/debian.cf b/services/os/debian.cf index 3d73c2b..48f691d 100644 --- a/services/os/debian.cf +++ b/services/os/debian.cf @@ -1,4 +1,4 @@ -bundle common debian +bundle agent debian { vars: debian:: @@ -50,4 +50,7 @@ bundle common debian "weechat", "whois", }; + methods: + debian:: + "debian" usebundle => install_package("$(this.bundle)", "$(debian.packages)"); } diff --git a/services/os/freebsd.cf b/services/os/freebsd.cf index 7c930db..1029b25 100644 --- a/services/os/freebsd.cf +++ b/services/os/freebsd.cf @@ -6,9 +6,12 @@ bundle agent freebsd "bash", "ncdu", }; + methods: + freebsd:: + "freebsd" usebundle => install_package("$(this.bundle)", "$(freebsd.packages)"); } -bundle agent add_rc_conf_line(line) +bundle agent add_rc_conf_line(caller, line) { files: freebsd:: @@ -17,8 +20,8 @@ bundle agent add_rc_conf_line(line) edit_defaults => std_defs, perms => system_owned("444"), edit_line => append_if_no_line("$(line)"), - classes => if_repaired("freebsd_rc_conf_file_repaired"); + classes => if_repaired("$(caller)_freebsd_rc_conf_file_repaired"); reports: any:: - "$(this.bundle): /etc/rc.conf repaired" ifvarclass => "freebsd_rc_conf_file_repaired"; + "$(caller): /etc/rc.conf repaired" ifvarclass => "$(caller)_freebsd_rc_conf_file_repaired"; } diff --git a/services/os/ubuntu.cf b/services/os/ubuntu.cf index 58bd2d5..e3759b1 100644 --- a/services/os/ubuntu.cf +++ b/services/os/ubuntu.cf @@ -1,4 +1,4 @@ -bundle common ubuntu +bundle agent ubuntu { vars: ubuntu:: @@ -50,4 +50,7 @@ bundle common ubuntu "weechat", "whois", }; + methods: + ubuntu:: + "ubuntu" usebundle => install_package("$(this.bundle)", "$(ubuntu.packages)"); } |