Created
October 17, 2015 19:29
-
-
Save pedro-r-marques/14639ebbbe514a41f4e0 to your computer and use it in GitHub Desktop.
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: inventory, task variables and facts | |
hosts: | |
- test | |
tasks: | |
- name: example task | |
command: hostname | |
register: hostname_var | |
- name: facts can be determined by output of tasks | |
set_fact: | |
flag_task_a: "{{ hostname_var.stdout }}" | |
when: hostname_var.rc == 0 | |
- debug: var=flag_task_a | |
- debug: var=flag_task_b | |
- debug: var=flag_user_a | |
- debug: var=flag_user_b | |
- debug: var=flag_user_c | |
vars: | |
flag_task_a: "a" | |
flag_task_b: "b" | |
flag_user_a: "{{ flag_a | default('a') }} " | |
flag_user_b: "{{ flag_b | default('b') }} " | |
flag_user_c: "{{ flag_c | default('c') }} " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment