I was able to use the inventory_hostname as a workaround in templates, but I'm not the only one here, and other people in the company are likely to continue to use the ansible_fqdn as it's the widely-documented way to get the FQDN - and does work in some places.
I eventually tracked the problem with the reverse DNS lookups down, and it seems to have fixed the problem. On Wed, 14 Oct 2015 at 19:50 Dick Davies <[email protected]> wrote: > Picking through the code it seems to be whatever > > socket.getfqdn() > > returns in Python. > > side suggestion: why are you needing the hostname? could you just use the > inventory name instead in whatever template etc. you're having issues with? > > On 14 October 2015 at 00:51, Toby Corkindale <[email protected]> wrote: > >> On Wed, 14 Oct 2015 at 02:05 Brian Coca <[email protected]> wrote: >> >>> so the fqdn gets set first by trying to do reverse dns, which would >>> not use that /etc/hosts entry, if that fails it falls back to using >>> the gethostname function which does not guarantee a fully qualified >>> domain name. >>> >>> run 'hostname' on the command line, you should see the same output. >>> >> >> Well I guess the question is: how do I fix it? >> It sounds like I need to fix the reverse DNS lookups. >> >> I do note that running "hostname -f" from the command line DOES return >> the FQDN, by the way, even though "hostname" on its own does not. >> >> -Toby >> > -- >> 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 [email protected]. > > >> To post to this group, send email to [email protected]. >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/CABEgq96T9ubjgwc%2B1fbte0ExoiezJUzjScp8FORsxDCAwTh%3DuA%40mail.gmail.com >> <https://groups.google.com/d/msgid/ansible-project/CABEgq96T9ubjgwc%2B1fbte0ExoiezJUzjScp8FORsxDCAwTh%3DuA%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . > > >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to a topic in the > Google Groups "Ansible Project" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/ansible-project/ReYfcByti08/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/CAK5eLPTSmC4s3EP88zhOGCsHjE%2B3mCQf0v2qV8T_%3Dn0h-0qZFw%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CAK5eLPTSmC4s3EP88zhOGCsHjE%2B3mCQf0v2qV8T_%3Dn0h-0qZFw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CABEgq96SLOHAVWLp%3Dx-kF2oiSJawCTPdP-4LxbhCA3d%2B2gLH7A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
