You have two different variable names there: 'ansible_all_ipv4_address' and
'ansible_all_ipv4_addresses'.
Nathan
On Monday, 2 December 2013 11:48:04 UTC-8, Steven Truong wrote:
>
> Hi all,
>
> Using the info from the document, I tried this but this totally does not
> work. I tried a few different varibles such as ansible_ipv4 and nothing
> seemed to work.
>
> {% for host in groups['iad2-ads'] %}
> server {{ inventory_hostname }} {{
> hostvars[host]['ansible_all_ipv4_address'] }}:80 check
> {% endfor %}
>
> Output:
>
> fatal: [iad2-lb2] => {'msg': "One or more undefined variables: 'dict'
> object has no attribute 'ansible_all_ipv4_address'", 'failed': True}
> fatal: [iad2-lb2] => {'msg': "One or more undefined variables: 'dict'
> object has no attribute 'ansible_all_ipv4_address'", 'failed': True}
> fatal: [iad2-lb3] => {'msg': "One or more undefined variables: 'dict'
> object has no attribute 'ansible_all_ipv4_address'", 'failed': True}
> fatal: [iad2-lb3] => {'msg': "One or more undefined variables: 'dict'
> object has no attribute 'ansible_all_ipv4_address'", 'failed': True}
> fatal: [iad2-lb4] => {'msg': "One or more undefined variables: 'dict'
> object has no attribute 'ansible_all_ipv4_address'", 'failed': True}
> fatal: [iad2-lb4] => {'msg': "One or more undefined variables: 'dict'
> object has no attribute 'ansible_all_ipv4_address'", 'failed': True}
> fatal: [iad2-lb1] => {'msg': "One or more undefined variables: 'dict'
> object has no attribute 'ansible_all_ipv4_address'", 'failed': True}
> fatal: [iad2-lb1] => {'msg': "One or more undefined variables: 'dict'
> object has no attribute 'ansible_all_ipv4_address'", 'failed': True}
>
> FATAL: all hosts have already failed -- aborting
>
> Here is the output from module setup and it clearly show that this
> variable is available...
>
> ansible iad2-ads -m setup |grep ansible_all_ipv4_address
> "ansible_all_ipv4_addresses": [
> "ansible_all_ipv4_addresses": [
> "ansible_all_ipv4_addresses": [
> "ansible_all_ipv4_addresses": [
> "ansible_all_ipv4_addresses": [
> "ansible_all_ipv4_addresses": [
> "ansible_all_ipv4_addresses": [
> "ansible_all_ipv4_addresses": [
> "ansible_all_ipv4_addresses": [
> "ansible_all_ipv4_addresses": [
> "ansible_all_ipv4_addresses": [
> "ansible_all_ipv4_addresses": [
> "ansible_all_ipv4_addresses": [
> "ansible_all_ipv4_addresses": [
> "ansible_all_ipv4_addresses": [
> "ansible_all_ipv4_addresses": [
> "ansible_all_ipv4_addresses": [
> "ansible_all_ipv4_addresses": [
> "ansible_all_ipv4_addresses": [
> "ansible_all_ipv4_addresses": [
> "ansible_all_ipv4_addresses": [
> "ansible_all_ipv4_addresses": [
> "ansible_all_ipv4_addresses": [
> "ansible_all_ipv4_addresses": [
> "ansible_all_ipv4_addresses": [
> "ansible_all_ipv4_addresses": [
>
>
> Please help.
>
> Thanks,
> Steven.
>
--
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].
For more options, visit https://groups.google.com/groups/opt_out.