Skip to content

Instantly share code, notes, and snippets.

@fabiocruzcoelho
Created April 5, 2018 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabiocruzcoelho/bce636bf8432ae946e761a6eb6a3ed10 to your computer and use it in GitHub Desktop.
Save fabiocruzcoelho/bce636bf8432ae946e761a6eb6a3ed10 to your computer and use it in GitHub Desktop.
[host_group]
host-1 ansible_ssh_host=192.168.0.21 node_name=foo
host-2 ansible_ssh_host=192.168.0.22 node_name=bar
[host_group:vars]
custom_var=asdasdasd
You can access host group vars using:
{{ hostvars['host_group'].custom_var }}
If you need a specific value from specific host, you can use:
{{ hostvars[groups['host_group'][0]].node_name }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment