Skip to content

Instantly share code, notes, and snippets.

@fizerkhan
Created April 1, 2015 13:33
Show Gist options
  • Select an option

  • Save fizerkhan/139e25e0399d565a95c8 to your computer and use it in GitHub Desktop.

Select an option

Save fizerkhan/139e25e0399d565a95c8 to your computer and use it in GitHub Desktop.
Ansible variable procedence
[servers]
127.0.0.1
---
#roles/common/tasks/main.yml
- name: debug message
debug: msg="Variable {{ server_name }} "
---
- hosts: servers
gather_facts: False
roles:
- common
vars:
server_name: "big orange"
---
#roles/common/vars/main.yml
server_name: "big apple"
@fizerkhan
Copy link
Author

Above code always print "big apple". It always take higher precedence to roles variables instead of plays variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment