Accessing inventory host variable in Ansible playbook

You are on the right track about hostvars. This magic variable is used to access information about other hosts. hostvars is a hash with inventory hostnames as keys. To access fields of each host, use hostvars[‘test-1’], hostvars[‘test2-1’], etc. ansible_ssh_host is deprecated in favor of ansible_host since 2.0. So you should first remove “_ssh” from inventory … Read more