On 10. juli 2017 00:50, Kethzer Docteur wrote:


Im trying to have ansible Update variable value base on OS distribution, but Im 
faling when I insert the rules in a template.
Any idea how to solve this?

---
- hosts: fansible,cansible
   vars:
     nagios_freebsd_load: -w 75,70,65 -c 90,85,80
     nagios_centos_load: -w 15,10,5 -c 30,25,20
     nagios_server_load: vars['nagios_{{ ansible_distribution|lower }}_load']

To make it work use
nagios_server_load: "{{ vars['nagios_' ~ ansible_distribution|lower ~ '_load'] }}"


--
Kai Stian Olstad

--
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/7b6866cf-bef5-fc41-25c3-996e3b961645%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to