Where is ansible_fqdn coming from?

8,204 views
Skip to first unread message

Nolan Darilek

unread,
Mar 10, 2014, 6:14:05 PM3/10/14
to ansible...@googlegroups.com
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.

Matt Martz

unread,
Mar 10, 2014, 6:21:30 PM3/10/14
to Nolan Darilek, ansible...@googlegroups.com
It comes from the socket python module:


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. 
-- 
Matt Martz
ma...@sivel.net
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/531E392D.2000506%40thewordnerd.info.
For more options, visit https://groups.google.com/d/optout.

David Karban

unread,
Mar 11, 2014, 4:54:20 AM3/11/14
to ansible...@googlegroups.com
Is it possible, that you have entries for thewordnerd.info in /etc/hosts on your business server?


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.



--
David Karban
Specialista na správu linuxových serverů
www.karban.eu
Reply all
Reply to author
Forward
0 new messages