[icinga-checkins] icinga.org: icinga2-ansible/master: Added a conditional to deal with generics ansible_domain

git at icinga.org git at icinga.org
Sat Jun 7 13:16:05 CEST 2014


Module: icinga2-ansible
Branch: master
Commit: 8b64710c6faee1ddf543c4a7ea8ca05f1d37673f
URL:    https://git.icinga.org/?p=icinga2-ansible.git;a=commit;h=8b64710c6faee1ddf543c4a7ea8ca05f1d37673f

Author: Valentino Gagliardi <valentino.g at servermanaged.it>
Date:   Thu Jun  5 19:36:25 2014 +0200

Added a conditional to deal with generics ansible_domain

---

 templates/host_def.j2     |    7 +++++++
 vars/icinga2_services.yml |    2 ++
 2 files changed, 9 insertions(+)

diff --git a/templates/host_def.j2 b/templates/host_def.j2
index 214f592..c8a8845 100644
--- a/templates/host_def.j2
+++ b/templates/host_def.j2
@@ -1,11 +1,18 @@
 object Host "{{ hostvars[item]['ansible_fqdn'] }}" {
+
+  #Inventory hostname of this host (to give you a bit of context) is: {{ hostvars[item]['inventory_hostname'] }}
   import "generic-host"
   address = "{{ hostvars[item]['ansible_eth0']['ipv4']['address'] }}"
   vars.sla = "24x7"
 
 {% if http_check == "yes" %}
   vars.http = "yes"
+{% if hostvars[item]['ansible_domain'] == generic_domain %}
+#Generic ansible_domain {{ generic_domain }} detected, using ansible_fqdn for http_vhost
+  vars.http_vhost = "{{ hostvars[item]['ansible_fqdn'] }}"
+{% else %}
   vars.http_vhost = "www.{{ hostvars[item]['ansible_domain'] }}"
+{% endif %}
 {% else %}
   vars.http = "no"
 {% endif %}
diff --git a/vars/icinga2_services.yml b/vars/icinga2_services.yml
index 67552ad..354c8fb 100644
--- a/vars/icinga2_services.yml
+++ b/vars/icinga2_services.yml
@@ -7,3 +7,5 @@ services:
  - { template: "load_nrpe_service.j2" , config: "load_nrpe_service.conf" }
  - { template: "disk_nrpe_service.j2" , config: "disk_nrpe_service.conf" }
  - { template: "home_nrpe_service.j2" , config: "home_nrpe_service.conf" }
+
+generic_domain: "ovh.net"



More information about the icinga-checkins mailing list