fact gathering is a play level directive

(see http://docs.ansible.com/ansible/playbooks_keywords.html#play)

from the doc:

*gather_facts:* A boolean that controls if the play will automatically run
the ‘setup’ task to gather facts for the hosts


and one can run the setup module at anytime during the course of tasks
execution to do it
see http://docs.ansible.com/ansible/setup_module.html




2017-06-21 13:06 GMT+02:00 Frank Thommen <[email protected]>:

> On 06/21/2017 11:01 AM, [email protected] wrote:
>
>> Hi Frank,
>>
>> 21 juin 2017 10:29 "Frank Thommen" <[email protected]> a écrit:
>>
>> Hi,
>>>
>>> from ansible's documentation I don't understand how ansible handles fact
>>> gathering when using
>>> roles: Are a host's facts gathered at each single playbook run? Or at
>>> each "role" run? Or only
>>> once?
>>>
>>> In most cases one would want to gather facts only once in the beginning,
>>> but is this the case
>>> and/or how can I check this?
>>>
>>
>> This is at playbook level, not at role level
>>
>
> I.e. for a playbook roles/common/tasks/main.yml which is
>
> ---
> - include: tasks_1.yml
> - include: tasks_2.yml
>
> fact gathering would only happen once or once per *.yml (I'm not
> completely sure which is the playbook and which the task in this setup,
> sorry)
>
> For me the gathering fact happens each time a new block of hosts/tasks in
>> the playbook
>> You can control it by using gather_facts: no to skip it.
>>
>
> The concrete example is more complicated, since some include are only done
> on special conditions.  Therefore I cannot really know from the beginning,
> which tasks are run and which not.  Consequently I wouldn't know where to
> gather and where not.
>
> frank
>
>
> --
> 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 post to this group, send email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/ms
> gid/ansible-project/805a8b57-beca-c669-f0df-7ab306e0ec72%40drosera.ch.
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAB1FMuQ%2Bgp55CrM_Kqy6v%2B6yv467_AOrfu%3DDkKvaArtxiXurHw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to