Created
April 1, 2015 13:33
-
-
Save fizerkhan/139e25e0399d565a95c8 to your computer and use it in GitHub Desktop.
Ansible variable procedence
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [servers] | |
| 127.0.0.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| #roles/common/tasks/main.yml | |
| - name: debug message | |
| debug: msg="Variable {{ server_name }} " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| - hosts: servers | |
| gather_facts: False | |
| roles: | |
| - common | |
| vars: | |
| server_name: "big orange" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| #roles/common/vars/main.yml | |
| server_name: "big apple" |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Above code always print "big apple". It always take higher precedence to roles variables instead of plays variables.