Hello,
some of my plays on hosts need dynamic information from other hosts so I am trying to understand when/which variable in the playbooks become available in hostvars.
I undestand that :
- a variable defined via gather_facts is available via hostvars[host]
- a variable defined in host_vars is available via hostvars[host]
- a variable defined in group_vars/group is available via hostvars[host] if the host belong to the group
- a variable set on a host during a play via the register: syntax is available via hostvars[host]
- a call to set_fact: on a host makes the variable available via hostvars[host]
but a variable defined
- at the play/vars: level
- at the play/vars_files: level
- at the role/vars level
- role/default level
are not made available to hostvars[host]
Is this right ? is there a documentation explaining this along this angle that I could read ?
on a vocabulary perspective, is it correct to say that
- hostvars[host] contains all facts currently know about a host at a given step in the playbook execution
- all facts known about a given host at a given step in the playbook execution are available in hostvars[host]
Is there a simple way to express which variables become host facts ?
Thank you
Jerome