On 13. okt. 2016 15:47, 'Anas Theo' via Ansible Project wrote:
> As I have described in the previous comment, the problem was due to DNS
> searching for a DNS server that has not been accessible from the hosts. For
> that reason, I have tried to setup for these hosts, only the variable that
> I was going to use, using filter options like "filter=ansible_hostname" .
> However, it seems that the search time is the same. Is there any option to
> get the facts I want independently from the rest of them, in order to boost
> the performance of setup. Thanks for your help.
The setup module have gather_subset.
Set gather_facts to false and run the setup module with a subset in the
playbook.
- setup: gather_subset=!all
This will give very few facts, maybe this one is faster?
Or you could disable gather_facts and just run the same command as
ansible do the find hostname.
- command: python -c "import platform; print platform.node().split('.')[0]"
register: hostname
If you have the same name in ansible inventory file you could just use
inventory_hostname, then you would not need to gather facts at all.
--
Kai Stian Olstad