# DNS lookup issue on Ansible

**URL:** <https://forum.ansible.com/t/dns-lookup-issue-on-ansible/21747>\
**Category:** Ansible Project\
**Created:** [June 12, 2016, 2:57pm UTC](https://forum.ansible.com/t/dns-lookup-issue-on-ansible/21747 "2016-06-12T14:57:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julien\_Deloubes](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@Julien\_Deloubes](https://forum.ansible.com/u/Julien_Deloubes)\
**Post date:** [June 12, 2016, 2:57pm UTC](https://forum.ansible.com/t/dns-lookup-issue-on-ansible/21747/1 "2016-06-12T14:57:59Z")

</div>

Hello,  
i have a strange problem on Ansible 2.0, my playbook couldn’t resolve anymore the fqdn of my inventory.  
I can ssh to the machines in my inventory.  
I tried using an inventory file or specify the hosts with the -i option.  
I can run the playbook using the ip @.  
I’m scratching my head about what is happening, do you have any clues?

---

<div class="post-metadata">

**Author:** ![Julien\_Deloubes](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@Julien\_Deloubes](https://forum.ansible.com/u/Julien_Deloubes)\
**Post date:** [June 17, 2016, 1:20pm UTC](https://forum.ansible.com/t/dns-lookup-issue-on-ansible/21747/2 "2016-06-17T13:20:55Z")

</div>

Problem disappeared but finally reappeared after a few successful runs!  
I can always ssh on the impacted hosts.  
Don’t know where to search? Is Ansible has some sort of dns cache or something?

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [June 17, 2016, 2:58pm UTC](https://forum.ansible.com/t/dns-lookup-issue-on-ansible/21747/3 "2016-06-17T14:58:49Z")

</div>

I doubt ansible has its own dns cache.  
I forget which distro it was now but a while back i used to have to occasionally restart nscd service when I had dns problems like this.

Hope this helps,

Jon

---

<div class="post-metadata">

**Author:** ![Julien\_Deloubes](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@Julien\_Deloubes](https://forum.ansible.com/u/Julien_Deloubes)\
**Post date:** [September 16, 2016, 11:12am UTC](https://forum.ansible.com/t/dns-lookup-issue-on-ansible/21747/4 "2016-09-16T11:12:29Z")

</div>

Hello,  
the problem was not DNS related, it was the hostname of my machines that were too long.  
He did solve the problem by adding this to my ansible.cfg:

control\_path = %(directory)s/%%h-%%r  
#control\_path = %(directory)s/ansible-ssh-%%h-%%p-%%r

Hope this will help!
