Is it possible to have multiple 'inventories'? Like a touch list and do not 
touch list? 

On Friday, September 16, 2022 at 2:55:07 PM UTC-4 ehi...@gmail.com wrote:

> If hosts are not in the inventory then they dont exist for Ansible. Group 
> variables are different than host variables, by the way. 
>
> On Fri, Sep 16, 2022, 1:41 PM Dick Visser <dnmv...@gmail.com> wrote:
>
>> Ok thanks for clearing this up.
>> Just to be sure: it is not possible to access variables for hosts that 
>> are not in the inventory?
>>
>>
>>
>> On Fri, 16 Sep 2022 at 16:25, Brian Coca <bc...@redhat.com> wrote:
>>
>>> > vars_files:
>>> >    - group_vars/web/main.yml
>>> Do not load group_vars/host_vars directly, this is the job of the vars 
>>> plugin,
>>> you create duplicate entries and mask the actual expected values from
>>> normal precedence resolution.
>>>
>>>  >  msg: '{{ hostvars[groups[''web''][0]].foopass }}: ''dict object''
>>> has no attribute ''web'''
>>> This is not because host is not in current play, it is because the
>>> host is not in inventory, which is a very different issue.
>>>
>>> If you want to skip the tasks conditionally, check that the group is
>>> present and has at least one host:
>>>
>>>    when: "'web' in groups and groups['web'][0]"
>>>
>>>
>>> ----------
>>> Brian Coca
>>>
>>> -- 
>>> 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/CACVha7dH1f2YH76XvHaUs5%3D00GD%2B6XcZoFMeb-C%3DOxE%2BGd%2BaxA%40mail.gmail.com
>>> .
>>>
>> -- 
>> Sent from Gmail Mobile
>>
>> -- 
>> 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/CAF8BbLYBKJuBhZq70t56DQX3j9Q9TkwSbzVfSwk2Je15uN3-Tg%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/CAF8BbLYBKJuBhZq70t56DQX3j9Q9TkwSbzVfSwk2Je15uN3-Tg%40mail.gmail.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/fafe3b7f-43b7-47d6-a736-50eb844a3123n%40googlegroups.com.

Reply via email to