Resolve DNS / gather_facts

58 views
Skip to first unread message

Nico K.

unread,
Jul 18, 2014, 3:25:10 AM7/18/14
to ansible...@googlegroups.com
Hi,

I've been reading through a lot of posts regarding the subject of "fact gathering" and I'm under the impression that it's impossible to force fact gathering on hosts when using '--limit'?
My specific use case would be obtaining IP addresses of all hosts to populate the firewall ruleset with.

Ideally I would like to force gathering the facts on a couple of the groups I have defined no matter what the '--limit' is set to.

For the time being, is there a work around? Is there an easy way to resolve a DNS entry?

Thanks,
Nico

Michael DeHaan

unread,
Jul 18, 2014, 7:46:07 AM7/18/14
to ansible...@googlegroups.com
You cannot force fact gathering on other hosts not in the limit group when using --limit.

The solution is to not use limit and do something like:

- hosts: all
  gather_facts: True
  tasks: []

- hosts: "somegroup{{optional_limit|default('')}}"
   tasks:
      -

And run ansible-playbook sometimes with

ansible-playbook foo.yml -e "optional_limit=&boston"

If you need the behavior.

I agree that's gross.

What we really need to do is be able to allow "--limit" to control the default limit, and at play level allow a "limit: all" to be passed in (which should be the default).

Pull requests to this effect, if sufficiently clean would be entertained.

I think that's nicer than having to do go through those hoops above.


--
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 post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/401633e4-5c78-45a4-af73-86b1a97dd3ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages