I think ansible_hostname is a property of the ssh connection. I'm pretty
certain it is not present when you use, for example, wirnm connection.
This is a complete guess but I wonder if in your case sometimes it is
failing to set up ssh connection and then falling back to another
connection type (say paramiko) which perhaps doesn't have ansible_hostname
defined.
Hope this helps,
Jon
On Saturday, April 16, 2016 at 12:21:05 AM UTC+1, Guy Knights wrote:
>
> I have a weird issue where occasionally when I run a playbook that has a
> task which uses the {{ ansible_hostname }} variable in it, I get an
> error "'ansible_hostname' is undefined". In most cases, if I re-run the
> playbook again right after I see the errors, it works fine and I don't see
> these errors.
>
> Does anyone know why this might be happening?
>
> Thanks,
> Guy
>
--
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/cd4a75a4-e1d3-432c-9ff3-79721ea5ca39%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.