Where is ansible_fqdn coming from?

I have the following tasks:

- copy: src={{ansible_fqdn}}.crt dest=/etc/ssl/certs mode=0440 group=ssl-cert
   when: ssl is defined
- copy: src={{ansible_fqdn}}.key dest=/etc/ssl/private mode=0440 group=ssl-cert
   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.

It comes from the socket python module:

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.

Is it possible, that you have entries for thewordnerd.info in /etc/hosts on your business server?