Acceso a la variable de host de inventario en el libro de jugadas ansible
Estoy usando ansible 2.1. Tengo el siguiente archivo de host de inventario y una función a la que llama una obra que necesita acceso a la variable del archivo de host. Alguna idea sobre cómo acceder a ella (actualmente obteniendo un error):
archivo de host
[test1]
test-1 ansible_ssh_host=abc.def.ghi.jkl ansible_ssh_port=1212
[test2]
test2-1 ansible_ssh_host=abc.def.ghi.mno ansible_ssh_port=1212
[test3]
test3-1 ansible_ssh_host=abc.def.ghi.pqr ansible_ssh_port=1212
test3-2 ansible_ssh_host=abc.def.ghi.stu ansible_ssh_port=1212
[all:children]
test1
test2
test3
papel He intentado acceder a la función de la siguiente manera:
{{ hostvars.ansible_ssh_host }}
&&
{{ hostvars.test1.ansible_ssh_host }}
Estoy tratando de acceder a ansible_ssh_host en la sección test1.
Error
fatal: [localhost]: FAILED! => {"failed": true, "msg": "'ansible.vars.hostvars.HostVars object' has no attribute 'ansible'"}