Resolve DNS / gather_facts

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

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: