Special Variables — Ansible Documentation
docs.ansible.com › special_variablesDec 21, 2021 · See Discovering variables: facts and magic variables for more information. ansible_facts. Contains any facts gathered or cached for the inventory_hostname Facts are normally gathered by the setup module automatically in a play, but any module can return facts. ansible_local. Contains any ‘local facts’ gathered or cached for the inventory_hostname. The keys available depend on the custom facts created.
How store full host name as variable in ansible? - Stack Overflow
stackoverflow.com › questions › 63508525Aug 20, 2020 · --- - name: Ansible Script hosts: all vars: host1_short : '123' host2_short : '345' tasks: - name: set host set_fact: host1_full: "{{inventory_hostname}}" when: inventory_hostname_short == host1_short - name: print info debug: msg: "host - {{host1_full}}" - name: block1 block: - name:running PS1 file win_shell: "script.ps1" register: host1_output when: inventory_hostname_short == host1_short - name: block2 block: - name: set host set_fact: IN_PARA: "{{ hostvars[host1_full]['host1_output ...