well i did not define anything now, it is working as my original. I just
use hosts: all  instead of hosts: db.

On Sat, Jan 30, 2021 at 9:37 AM Mike Eggleston <mikeegg1...@gmail.com>
wrote:

> I don’t mind at all. :)
>
> —
> - hosts: all
>   gather_facts: yes
>
>   vars:
>     ip0: “”
>     ip1: “”
>     ip2: “”
>
>   tasks:
>     - set_fact:
>         ip0: “{{ansible_all_ipv4_addressess[0]}}”
>       when: ansible_all_ipv4_addresses[0] is defined
>
> And the same for 1 and 2.
>
> Mike
>
> On Jan 30, 2021, at 09:13, Aris Aguirre <aris.h...@gmail.com> wrote:
>
> DO you mind showing me, Is this a new problem?
>
> On Friday, January 29, 2021 at 5:28:09 PM UTC-6 mikee...@gmail.com wrote:
>
>> I just solved this for me today. I’m away from work so I can’t copy my
>> code. I created ip0, ip1 and ip2 in vars, set gather facts and did a set
>> facts using a when is defined.
>>
>> Mike
>>
>> On Jan 29, 2021, at 16:18, Aris Aguirre <aris...@gmail.com> wrote:
>>
>> 
>>
>> NO funky.... it is just not working if it is being user in FOR LOOP. As
>> ive said..its working fine in Jinja template or 2.3 2.7. But its not workin
>> in the for loop like before.
>>
>> ansible dev -m setup |grep -i ipv4
>>         "ansible_all_ipv4_addresses": [
>>         "ansible_default_ipv4": {
>>                 "tx_checksum_ipv4": "off [fixed]",
>>             "ipv4": {
>>                 "tx_checksum_ipv4": "off [fixed]",
>>                 "tx_checksum_ipv4": "off [fixed]",
>>             "ipv4": {
>>
>>
>>
>> On Friday, January 29, 2021 at 2:34:17 PM UTC-6 raub...@gmail.com wrote:
>>
>>> On Fri, Jan 29, 2021 at 10:46 AM Aris Aguirre <aris...@gmail.com>
>>> wrote:
>>> >
>>> > Below is working when I was still using ansible 2.3 or maybe 2.7 But
>>> no longer ansible 2.8 or 2.9. Please be advise no matter what it is not
>>> working.
>>> > Thanks
>>> >
>>> > {% for host in groups.all %}
>>> > {{ hostvars[host]['ansible_all_ipv4_addresses'][0] }} {{
>>> hostvars[host]['ansible_fqdn'] }} {{
>>> hostvars[host]['inventory_hostname_short'] }}
>>> > {% endfor %}
>>> >
>>> > Below is the actual error.
>>> >
>>> > FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable:
>>> 'ansible.vars.hostvars.HostVarsVars object' has no attribute
>>> 'ansible_all_ipv4_addresses'"}
>>> >
>>> Something else might be funky there:
>>>
>>> raub@desktop:~/dev/ansible$ ansible dns2 -m setup |grep -i ipv4
>>> "ansible_all_ipv4_addresses": [
>>> "ansible_default_ipv4": {
>>> "tx_checksum_ipv4": "off [fixed]",
>>> "ipv4": {
>>> "tx_checksum_ipv4": "off [fixed]",
>>> "ipv4": {
>>> "tx_checksum_ipv4": "off [fixed]",
>>> "ipv4": {
>>> raub@desktop:~/dev/ansible$ ansible --version
>>> ansible 2.9.17
>>> config file = /home/raub/dev/ansible/ansible.cfg
>>> configured module search path =
>>> [u'/home/raub/.ansible/plugins/modules',
>>> u'/usr/share/ansible/plugins/modules']
>>> ansible python module location =
>>> /usr/lib/python2.7/dist-packages/ansible
>>> executable location = /usr/bin/ansible
>>> python version = 2.7.12 (default, Oct 5 2020, 13:56:01) [GCC 5.4.0
>>> 20160609]
>>> raub@desktop:~/dev/ansible$
>>>
>>> > --
>>> > 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-proje...@googlegroups.com.
>>> > To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/ansible-project/0bc08e12-07aa-4df5-854c-4bcba9324605n%40googlegroups.com.
>>>
>>>
>>
>> --
>> 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-proje...@googlegroups.com.
>>
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/9e77fa1d-66b5-4959-a933-01cea5110053n%40googlegroups.com
>> <https://groups.google.com/d/msgid/ansible-project/9e77fa1d-66b5-4959-a933-01cea5110053n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/f1053ed2-8a14-42d1-ae13-191758235a60n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/f1053ed2-8a14-42d1-ae13-191758235a60n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/QtciviR_CBg/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/59FCD0D4-959D-4E82-BE70-BA0C8BC30998%40gmail.com
> <https://groups.google.com/d/msgid/ansible-project/59FCD0D4-959D-4E82-BE70-BA0C8BC30998%40gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAKdWzv%3DsgA3%3DR%3DkX%3DUqtwhxYR175V85Za8GoFU4Z-%2B9hqe0FcQ%40mail.gmail.com.

Reply via email to