Fact-caching will eliminate the need for the following workaround, but if
you are stuck in pre 1.8 ansible...
If you have a bunch of plays in a site.yml and are a big fan of
--start-at-task like i am, then there is a problem if downstream plays also
require gathered facts.
Having gather_facts: yes for every play slows things down.
- hosts: all
gather_facts: yes
- hosts: group1
gather_facts: no # faster not to gather_facts if we got them above
roles:
- role-that-uses-facts
But then if you start-at-task on the group1 play you don't have the facts
you need.
My solution was to have the first role always gather facts for normal runs.
- hosts: zoo
gather_facts: "{{ zoo_facts | default('no')}}"
Then when debugging/developing i run with
ansible-playbook -i hosts site.yml --start-at-task="task in zoo role" -e
"zoo_facts=yes"
So we can start mid run, and switch on gathering facts for that role, but
normally only the first play will gather facts.
On Friday, August 29, 2014 10:22:49 AM UTC-5, Michael Dur wrote:
>
> We have many playbooks, and groups.
> I notice when I do a full site run that at the beginning of the 'top
> level' playbooks, that is those referenced by site.yml, that facts are
> gathered each time.
> I realize I can disable gathering facts for a given playbook.
> Are facts that are previously gathered carried forward, allowing us to
> gather just once for a run?
>
> Thanks!
> -Michael
>
--
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/9e76926e-40d3-4fe8-8e93-e05e83e7df2e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.