I want to create a role to do a dynamic update of my Nagios configuration 
when I create a new VM.

So to do that, i already created a role which add a host definition at the 
end of my servers.cfg Nagios file, it looks like :

- name: Add {{ Host_Name }} in /etc/naemon/conf.d/hosts/servers.cfg
  blockinfile:
    dest: /etc/naemon/conf.d/hosts/servers.cfg
    block: |
      define host {
        host_name                      {{ Host_Name }}
        alias                          {{ Host_Name }}.uem.lan
        address                        {{ Host_IP }}
        use                            modele_host,host-pnp
      }
    marker:   ""
    backup: yes

It works well.

So now I would like to be able to add my "{{ Host_Name }}" server directly 
at the end of lines of checks files.

Exemple : This is a check to monitore /data partition :

define service {
  service_description            /data partition
  host_name                      myserv1,myserv2,myserv3,myserv4,myserv5
  use                            srv-pnp,modele_service_disk_linux_snmp
  check_command                  check_snmp_storage!uem_snmp!/data$!90!95
}

And I would to add my "{{ Host_Name }}" like that :

define service {
  service_description            /data partition
  host_name                      myserv1,myserv2,myserv3,myserv4,myserv5,{{ 
Host_Name }}
  use                            srv-pnp,modele_service_disk_linux_snmp
  check_command                  check_snmp_storage!uem_snmp!/data$!90!95
}

Would anyone have a solution?

Thx :)

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/23faaccb-6e70-4c1f-abf3-791f177e4de4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to