re: always gathering facts on all hosts, regardless of tags/limits.

What I’ve been doing is creating a facts.yml file that looks like this:

—
- name: gather facts for api_endpoints
  hosts: api_endpoints

- name: gather facts for zookeepers
  hosts: zookeepers

… and so on …


Then, as the first directive of every top-level playbook I write this:

- include: facts.yml


Maybe this doesn’t hit all the cases that you need (?) but it’s worked for me 
so far. Hope that helps.


On Mar 24, 2014, at 11:43 AM, Grzegorz Nosek <[email protected]> wrote:

> Hi,
> 
> Sorry to dig up this thread again but it's also an issue for me.
> 
> AIUI, Strahinja Kustudić needs (just as I do) a way to always gather facts on 
> all hosts, regardless of tags/limits. What your proposal does is (again, 
> AIUI) improve performance without the need of gather_facts: false in every 
> play. It's cool but different. We need different functionality, not better 
> performance.
> 
> Consider:
> 
> ---
> - hosts: vpn_clients
>   gather_facts: force
>   tasks:
>   - apt: pkg=openvpn-or-whatever
> 
> - hosts: vpn_hub
>   tasks:
>   - template: src=uses_facts_from_vpn_clients.j2
> 
> I'd love this playbook to do exactly the same thing on vpn_hub when ran with 
> -l vpn_hub and without. Otherwise whenever I want to simply regenerate the 
> vpn_hub's config, I'll either reconfigure all the clients again (time 
> consuming), generate a totally broken config (no clients' facts on hub), or 
> write a separate top-level playbook just for this one single task (not DRY 
> and/or ravioli code).
> 
> FWIW, I'm totally fine with calling setup manually on these hosts, so maybe 
> something like the following would be better? I'm willing to implement 
> anything that stands a chance of being accepted.
> 
> - hosts: vpn_clients
>   tasks:
>   - setup:
>     ignore_tags: true
>     ignore_limit: true
>   - apt: pkg=openvpn-or-whatever
> 
> - hosts: vpn_hub
>   tasks:
>   - template: src=uses_facts_from_vpn_clients.j2
> 
> Or make the ignore_* attributes of the play instead of a particular task if 
> that makes anything easier.
> 
> All comments appreciated.
> 
> Best regards,
>  Grzegorz Nosek
> 
> W dniu piątek, 14 marca 2014 17:42:26 UTC+1 użytkownik Michael DeHaan napisał:
> We've discussed this and what we want to do with gather_facts is make a 
> config setting
> 
> gather_facts_tendancy:  always or lazy, default always
> 
> and then if you want to force when it's lazy, you could just call the '- 
> setup' module in the tasks section.
> 
> 
> 
> 
> 
> On Fri, Mar 14, 2014 at 12:28 PM, Strahinja Kustudić <[email protected]> 
> wrote:
> I know this is now and old topic, but it didn't make sense to open a new one.
> 
> Having offline cache would be nice, but wouldn't be easier to make something 
> like:
> 
> gather_facts: force or gather_facts_force: True
> 
> or something similar, so that this overrides --limit / --tags and always 
> gathers facts.
> 
> 
> -- 
> 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/f90Y4T4SJfQ/unsubscribe.
> To unsubscribe from this group and all its topics, 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/83bb88e8-d4dd-42d9-abab-2ca0bea64c4c%40googlegroups.com.
> 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/08BEA3CA-9909-4D31-843D-AAB0AA117D77%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to