From 0c61e77a775900ff0cc79377a274a858eb06b6b9 Mon Sep 17 00:00:00 2001 From: xFuture603 Date: Tue, 11 Jan 2022 10:15:10 +0100 Subject: [PATCH] removed if in our constants.conf --- roles/icinga_agent/defaults/main.yml | 29 ++++++++++--------- .../templates/configuration/constants.conf.j2 | 6 +--- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/roles/icinga_agent/defaults/main.yml b/roles/icinga_agent/defaults/main.yml index cd66eb3..d6c1cb2 100644 --- a/roles/icinga_agent/defaults/main.yml +++ b/roles/icinga_agent/defaults/main.yml @@ -2,20 +2,21 @@ icinga_agent_package: icinga2 icinga_agent_registration: false icinga_agent_ca_host_icinga_port: 5665 -icinga_agent_constants_conf_rhel: | - const PluginDir = "/usr/lib64/nagios/plugins" - const PluginContribDir = "/usr/lib64/nagios/plugins" - const ManubulonPluginDir = "/usr/lib64/nagios/plugins" - const ZoneName = "{{ ansible_hostname }}" - const NodeName = "{{ ansible_hostname }}" - const TicketSalt = "" -icinga_agent_constants_conf_debian: | - const PluginDir = "/usr/lib/nagios/plugins" - const PluginContribDir = "/usr/lib/nagios/plugins" - const ManubulonPluginDir = "/usr/lib/nagios/plugins" - const ZoneName = "{{ ansible_hostname }}" - const NodeName = "{{ ansible_hostname }}" - const TicketSalt = "" +icinga_agent_constants: + RedHat: | + const PluginDir = "/usr/lib64/nagios/plugins" + const PluginContribDir = "/usr/lib64/nagios/plugins" + const ManubulonPluginDir = "/usr/lib64/nagios/plugins" + const ZoneName = "{{ ansible_hostname }}" + const NodeName = "{{ ansible_hostname }}" + const TicketSalt = "" + Debian: | + const PluginDir = "/usr/lib/nagios/plugins" + const PluginContribDir = "/usr/lib/nagios/plugins" + const ManubulonPluginDir = "/usr/lib/nagios/plugins" + const ZoneName = "{{ ansible_hostname }}" + const NodeName = "{{ ansible_hostname }}" + const TicketSalt = "" icinga_agent_api_conf: | accept_config = true accept_commands = true diff --git a/roles/icinga_agent/templates/configuration/constants.conf.j2 b/roles/icinga_agent/templates/configuration/constants.conf.j2 index 57c4bb2..317ca9b 100644 --- a/roles/icinga_agent/templates/configuration/constants.conf.j2 +++ b/roles/icinga_agent/templates/configuration/constants.conf.j2 @@ -1,7 +1,3 @@ # {{ ansible_managed }} -{% if ansible_os_family == 'RedHat' %} - {{ icinga_agent_constants_conf_rhel }} -{% elif ansible_os_family == 'Debian' %} - {{ icinga_agent_constants_conf_debian }} -{% endif %}" +{{ icinga_agent_constants[ansible_os_family] }}