We have several playbooks that use hostvars[item]['ansible_nodename']
where item
is a host alias. It usually works. But sometimes does not, giving the following error:
'dict object' has no attribute 'ansible_nodename`
I printed the contents of hostvars
and did not see this attribute there.
I could not find the documentation of hostvars
to be able to see what we can safely use instead ansible_nodename
. So, the questions are:
- Can I safely replace
ansible_nodename
with ansible_host
?
- Where can I find a description of the contents of
hostvars
and algorithm of its creation?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…