Last active
September 10, 2015 01:15
-
-
Save caylorme/02faff5c65f9e2058e02 to your computer and use it in GitHub Desktop.
A bug in ansible?
This file contains 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
localhost inventory_variable=true ansible_connection=local |
This file contains 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
--- | |
- name: Testing Issue | |
hosts: all | |
pre_tasks: | |
- debug: var={{ item }} | |
with_items: | |
- inventory_variable | |
- playbook_variable | |
roles: | |
- role: role1 | |
playbook_variable: "{{ inventory_variable | default(false) }}" |
This file contains 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
--- | |
- name: Test Playbook Variable | |
debug: var=playbook_variable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ansible-playbook -i my_inventory playbook.yml
PLAY [Testing Issue] **********************************************************
GATHERING FACTS ***************************************************************
ok: [localhost]
TASK: [debug var={{ item }}] **************************************************
ok: [localhost] => (item=inventory_variable) => {
"item": "inventory_variable",
"var": {
"inventory_variable": "true"
}
}
ok: [localhost] => (item=playbook_variable) => {
"item": "playbook_variable",
"var": {
"playbook_variable": "playbook_variable"
}
}
TASK: [role1 | Test Playbook Variable] ****************************************
ok: [localhost] => {
"var": {
"playbook_variable": "False"
}
}
PLAY RECAP ********************************************************************
localhost : ok=3 changed=0 unreachable=0 failed=0