I am using the zabbix_hosts module.

Depending on the groups that a particular host is in, I need to link to 
various Zabbix templates.

So:
if a server is in dbservers I need to link it to "Template App MySQL"
if a server is in webservers I need to link it to "Template App HTTP 
Service"

If a server is in both groups, it needs to be linked to both the above 
templates.
Additionally all the servers need to be linked to "Template OS Linux"

So in the module group, the "setting link_templates:" will end up needing 
to be fed values such as:


      link_templates:
        - Template OS Linux
        - Template App MySQL


      link_templates:
        - Template OS Linux
        - Template App HTTP Service

      link_templates:
        - Template OS Linux
        - Template App HTTP Service
        - Template App MySQL

Of course, this is only a small subset of the possible groups/templates.

Can someone suggest a neat way to build up the list so that I can code the 
task as something like:

  - name: Create a new host or update an existing host's info
    local_action:
      module: zabbix_host
      server_url: http://zabbix.server/
      login_user: ansible
      login_password: ansible_password
      host_name: "{{ inventory_hostname }}"
      host_groups:
        - Linux servers
      link_templates: "{{ templates_list }}"
      status: enabled
      state: present
      interfaces:

TIA

-- 
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/058fa260-f41e-4163-9fca-a67e0e88e439%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to