setting gather_facts for a role ?

8 views
Skip to first unread message

Daniel Caillibaud

unread,
Dec 2, 2020, 8:35:28 AM12/2/20
to ansible...@googlegroups.com
Hi,

I saw that I can specify
gather_facts: no
in a playbook or a tasks list, but is it possible to precise it for a role ?

I tried on top of a roles/xxx/tasks.yml (because it's a tasks list) but it
throw a syntax error while loading yml

Thanks

--
Daniel

La guerre civile est moins détestable que la guerre avec l'étranger.
On sait du moins pourquoi l'on s'y bat.
Anatole France

Stefan Hornburg (Racke)

unread,
Dec 2, 2020, 11:45:32 AM12/2/20
to ansible...@googlegroups.com
On 12/2/20 2:35 PM, Daniel Caillibaud wrote:
> Hi,
>
> I saw that I can specify
> gather_facts: no
> in a playbook or a tasks list, but is it possible to precise it for a role ?
>
> I tried on top of a roles/xxx/tasks.yml (because it's a tasks list) but it
> throw a syntax error while loading yml
>
> Thanks
>

Gathering facts takes place at the beginning of a play, so why would you want to disable that in a role?

Regards
Racke

--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.

OpenPGP_signature

Daniel Caillibaud

unread,
Dec 3, 2020, 2:43:44 AM12/3/20
to ansible...@googlegroups.com
Le 02/12/20 à 17h44, "Stefan Hornburg (Racke)" <ra...@linuxia.de> a écrit :
> > I saw that I can specify
> > gather_facts: no
> > in a playbook or a tasks list, but is it possible to precise it for a
> > role ?
> >
> > I tried on top of a roles/xxx/tasks.yml (because it's a tasks list) but
> > it throw a syntax error while loading yml

> Gathering facts takes place at the beginning of a play, so why would you
> want to disable that in a role?

Because it's the role himself who knows if it needs facts or not (more
precisely the tasklist of the role should implies gather_facts or not).

- In a play, I chain roles but I don't know exactly if one role needs fact
or not

- If I add a --limit to the play run, perhaps that all roles which needs
facts are skipped (the target isn't in any group needing fact) so
gather_facts will be useless in that case.

--
Daniel

La pensée vole et les mots vont à pied. Voilà tout le drame de l'écrivain.
Julien Green
Reply all
Reply to author
Forward
0 new messages