Hi,
I have an inventory with groups this configuration the DB Servers:
[db]
192.168.0.1
192.168.0.2
192.168.0.3
I want to do loop the groups and get variable ipaddress in template.j2. My
loop is:
{% for host in groups['db'] -%}
host all postgres {{ hostvars[host].ansible_hostname
}}/32 trust
{% endfor %}
My error
"msg": "AnsibleUndefinedVariable: 'ansible.vars.hostvars.HostVarsVars
object' has no attribute 'ansible_hostname'",
What`s correct configuration?
--
Atenciosamente,
Rafael Tomelin
Tel.: 51-984104084
Skype: rafael.tomelin
LPI ID: LPI000191271
Red Hat Certified Engineer
Puppet Professional 2017 Certification
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAGEUqbCW9GZVwGQ%2BtqQopQBpOAEV-c7_08ud0TWu-AawmEDiRA%40mail.gmail.com.