# Where is ansible\_fqdn coming from?

**URL:** <https://forum.ansible.com/t/where-is-ansible-fqdn-coming-from/14750>\
**Category:** Ansible Project\
**Created:** [March 10, 2014, 10:14pm UTC](https://forum.ansible.com/t/where-is-ansible-fqdn-coming-from/14750 "2014-03-10T22:14:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nolan\_Darilek](https://avatars.discourse-cdn.com/v4/letter/n/919ad9/32.png) [@Nolan\_Darilek](https://forum.ansible.com/u/Nolan_Darilek)\
**Post date:** [March 10, 2014, 10:14pm UTC](https://forum.ansible.com/t/where-is-ansible-fqdn-coming-from/14750/1 "2014-03-10T22:14:05Z")

</div>

I have the following tasks:

- copy: src={{ansible\_fqdn}}.crt dest=/etc/ssl/certs mode=0440 group=ssl-cert  
&nbsp;&nbsp;&nbsp;when: ssl is defined  
- copy: src={{ansible\_fqdn}}.key dest=/etc/ssl/private mode=0440 group=ssl-cert  
&nbsp;&nbsp;&nbsp;when: ssl is defined

I have two separate Digital Ocean accounts, and am using the credentials for one that is business-related. But ansible\_fqdn in this play is set to thewordnerd.info, my personal domain.

I've run setup on the host. Interestingly enough, the hostname is correct, but ansible\_fqdn and ansible\_domain reflect the thewordnerd.info domain. I'm positive Ansible is connecting to the right host based on the IP returned in its output.

I've grepped through this repository multiple times. There is no instance of thewordnerd.info in the business-related repository, on the business-related DO account. When I log into the host, things look fine there too.

So, thoughts on where this separate account is getting thewordnerd.info as its ansible\_fqdn? This is Ansible 1.5.

Thanks.

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [March 10, 2014, 10:21pm UTC](https://forum.ansible.com/t/where-is-ansible-fqdn-coming-from/14750/2 "2014-03-10T22:21:30Z")

</div>

It comes from the socket python module:

[https://github.com/ansible/ansible/blob/release1.5.0/library/system/setup#L165](https://github.com/ansible/ansible/blob/release1.5.0/library/system/setup#L165)

Which does sort of the following:

Get the hostname of the server:

python -c “import socket; print socket.gethostname()”

Use that value to get the host by address:

python -c “import socket; print socket.gethostbyaddr(‘whatever\_we\_got\_from\_last\_command’)”

And then it loops through a list of the hostname (element 0 from the returned tuple) and a list of aliases (element 1 from the tuple).

The first one if finds with a ‘.’ in it is used as the fqdn.

That may have been a bit more explanation than you wanted, but at least that may help you.

---

<div class="post-metadata">

**Author:** ![David\_Karban](https://avatars.discourse-cdn.com/v4/letter/d/90db22/32.png) [@David\_Karban](https://forum.ansible.com/u/David_Karban)\
**Post date:** [March 11, 2014, 8:54am UTC](https://forum.ansible.com/t/where-is-ansible-fqdn-coming-from/14750/3 "2014-03-11T08:54:20Z")

</div>

Is it possible, that you have entries for [thewordnerd.info](http://thewordnerd.info) in /etc/hosts on your business server?
