empty ansible_domain from setup

I am running ansible 1.9.3 under FreeBSD 10.2 to manage other FreeBSD hosts.

I am trying to figure out why one host comes back with ansible_domain undefined, when it is fine for another host.

AFAIK both hosts are configured identically.

Can someone tell me how the value for this is determined?

Thanks!

this is the python code that figures out the domain:
`
  self.facts['fqdn'] = socket.getfqdn()
...
  self.facts['domain'] = '.'.join(self.facts['fqdn'].split('.')[1:])
`
^ basically splits from fqdn after the first . , so "www.example.com"
would return "example.com"

socket is a core python library and the method is explained here (with
some jumps) https://docs.python.org/2/library/socket.html#socket.getfqdn

Hope this helps narrow it down.

Thanks Brian, that’s a great place to start. I will see where that take me.

-Markham

SOLVED!

Also found this post helpful: https://groups.google.com/forum/#!msg/ansible-project/z27N4scKS-I/UfWyVk8Mug8J

It was an ordering issue within the /etc/hosts file.
I have some local aliasing setup as an artifact of legacy systems, and socket.getfqdn resolves these in order, where ansible grabs the first element for ansible_fqdn and ansible_domain.

192.0.2.2 localnickname 192.0.2.2 hostname.example.com hostname

These needed to be reversed to get the expected results