# Accessing variables of other hosts does not work (for me) on 1.4

**URL:** <https://forum.ansible.com/t/accessing-variables-of-other-hosts-does-not-work-for-me-on-1-4/14045>\
**Category:** Ansible Project\
**Created:** [December 2, 2013, 7:48pm UTC](https://forum.ansible.com/t/accessing-variables-of-other-hosts-does-not-work-for-me-on-1-4/14045 "2013-12-02T19:48:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steven\_Truong](https://avatars.discourse-cdn.com/v4/letter/s/df705f/32.png) [@Steven\_Truong](https://forum.ansible.com/u/Steven_Truong)\
**Post date:** [December 2, 2013, 7:48pm UTC](https://forum.ansible.com/t/accessing-variables-of-other-hosts-does-not-work-for-me-on-1-4/14045/1 "2013-12-02T19:48:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tannerjc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/tannerjc/32/985_2.png) [@tannerjc](https://forum.ansible.com/u/tannerjc)\
**Post date:** [December 2, 2013, 7:50pm UTC](https://forum.ansible.com/t/accessing-variables-of-other-hosts-does-not-work-for-me-on-1-4/14045/2 "2013-12-02T19:50:49Z")

</div>

Let's see what facts you do have ....

ansible -m setup -i \<inventory\_filename\> \<hostanme\> -a "filter=\*ipv4\*"

---

<div class="post-metadata">

**Author:** ![Nathan\_Howell](https://avatars.discourse-cdn.com/v4/letter/n/65b543/32.png) [@Nathan\_Howell](https://forum.ansible.com/u/Nathan_Howell)\
**Post date:** [December 2, 2013, 7:56pm UTC](https://forum.ansible.com/t/accessing-variables-of-other-hosts-does-not-work-for-me-on-1-4/14045/3 "2013-12-02T19:56:06Z")

</div>

You have two different variable names there: ‘ansible\_all\_ipv4\_address’ and ‘ansible\_all\_ipv4\_addresses’.

Nathan

---

<div class="post-metadata">

**Author:** ![Steven\_Truong](https://avatars.discourse-cdn.com/v4/letter/s/df705f/32.png) [@Steven\_Truong](https://forum.ansible.com/u/Steven_Truong)\
**Post date:** [December 3, 2013, 1:57am UTC](https://forum.ansible.com/t/accessing-variables-of-other-hosts-does-not-work-for-me-on-1-4/14045/4 "2013-12-03T01:57:21Z")

</div>

Hi,

That was a typos on my part in earlier emails.

I definitely think that I found something wrong here:

create /etc/haproxy/bb.cfg] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [iad2-lb1] =\> {‘msg’: “One or more undefined variables: ‘dict’ object has no attribute ‘ansible\_default\_ipv4’”, ‘failed’: True}  
fatal: [iad2-lb1] =\> {‘msg’: “One or more undefined variables: ‘dict’ object has no attribute ‘ansible\_default\_ipv4’”, ‘failed’: True}  
fatal: [iad2-lb4] =\> {‘msg’: “One or more undefined variables: ‘dict’ object has no attribute ‘ansible\_default\_ipv4’”, ‘failed’: True}  
fatal: [iad2-lb4] =\> {‘msg’: “One or more undefined variables: ‘dict’ object has no attribute ‘ansible\_default\_ipv4’”, ‘failed’: True}  
fatal: [iad2-lb3] =\> {‘msg’: “One or more undefined variables: ‘dict’ object has no attribute ‘ansible\_default\_ipv4’”, ‘failed’: True}  
fatal: [iad2-lb3] =\> {‘msg’: “One or more undefined variables: ‘dict’ object has no attribute ‘ansible\_default\_ipv4’”, ‘failed’: True}  
fatal: [iad2-lb2] =\> {‘msg’: “One or more undefined variables: ‘dict’ object has no attribute ‘ansible\_default\_ipv4’”, ‘failed’: True}  
fatal: [iad2-lb2] =\> {‘msg’: “One or more undefined variables: ‘dict’ object has no attribute ‘ansible\_default\_ipv4’”, ‘failed’: True}

FATAL: all hosts have already failed – aborting

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
to retry, use: --limit @/home/steven/iad2-loadbalancer.retry

iad2-lb1 : ok=4 changed=1 unreachable=1 failed=0  
iad2-lb2 : ok=4 changed=1 unreachable=1 failed=0  
iad2-lb3 : ok=4 changed=1 unreachable=1 failed=0  
iad2-lb4 : ok=4 changed=1 unreachable=1 failed=0

ansible iad2-ads -m setup |grep ansible\_default\_ipv4  
“ansible\_default\_ipv4”: {  
“ansible\_default\_ipv4”: {  
“ansible\_default\_ipv4”: {  
“ansible\_default\_ipv4”: {  
“ansible\_default\_ipv4”: {  
“ansible\_default\_ipv4”: {  
“ansible\_default\_ipv4”: {  
“ansible\_default\_ipv4”: {

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [December 3, 2013, 4:04am UTC](https://forum.ansible.com/t/accessing-variables-of-other-hosts-does-not-work-for-me-on-1-4/14045/5 "2013-12-03T04:04:14Z")

</div>

Please make sure there is a github ticket.

– Michael
