Created
November 20, 2017 14:25
-
-
Save odyssey4me/7673d9bf4321079e43d682e5d011a40f to your computer and use it in GitHub Desktop.
Show difference between static and dynamic include execution
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
--- | |
- name: Test conditional include (static) | |
hosts: localhost | |
connection: local | |
gather_facts: false | |
tasks: | |
- include: 01-included-tasks.yml | |
when: include_me | bool | |
- name: Test conditional include (dynamic) | |
hosts: localhost | |
connection: local | |
gather_facts: false | |
tasks: | |
- include: 01-included-tasks.yml | |
static: no | |
when: include_me | bool |
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
--- | |
- debug: | |
msg: "included-task -> include_me: {{ include_me }}" | |
- debug: | |
msg: "included-task -> arbitrary message" |
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
(ansible-2.3):~/venvs/ansible-2.3$ ansible-playbook 00-test-playbook.yml -e include_me=no | |
PLAY [Test conditional include (static)] *********************************************************************************************************************** | |
TASK [debug] *************************************************************************************************************************************************** | |
skipping: [localhost] | |
TASK [debug] *************************************************************************************************************************************************** | |
skipping: [localhost] | |
PLAY [Test conditional include (dynamic)] ********************************************************************************************************************** | |
TASK [include] ************************************************************************************************************************************************* | |
skipping: [localhost] | |
PLAY RECAP ***************************************************************************************************************************************************** | |
localhost : ok=0 changed=0 unreachable=0 failed=0 | |
(ansible-2.3):~/venvs/ansible-2.3$ ansible-playbook 00-test-playbook.yml -e include_me=yes | |
PLAY [Test conditional include (static)] *********************************************************************************************************************** | |
TASK [debug] *************************************************************************************************************************************************** | |
ok: [localhost] => { | |
"msg": "included-task -> include_me: yes" | |
} | |
TASK [debug] *************************************************************************************************************************************************** | |
ok: [localhost] => { | |
"msg": "included-task -> arbitrary message" | |
} | |
PLAY [Test conditional include (dynamic)] ********************************************************************************************************************** | |
TASK [include] ************************************************************************************************************************************************* | |
included: /Users/jess8308/venvs/ansible-2.3/01-included-tasks.yml for localhost | |
TASK [debug] *************************************************************************************************************************************************** | |
ok: [localhost] => { | |
"msg": "included-task -> include_me: yes" | |
} | |
TASK [debug] *************************************************************************************************************************************************** | |
ok: [localhost] => { | |
"msg": "included-task -> arbitrary message" | |
} | |
PLAY RECAP ***************************************************************************************************************************************************** | |
localhost : ok=5 changed=0 unreachable=0 failed=0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment