I would like to trim a large playbook down by looping through the tasks
using include_tasks in a parent playbook. However I need to be able to
track the return code and stdout from those tasks in the parent playbook in
order to determine overall play success. Is it possible to pass values
back into the parent? When I do the following the loop_result only includes
the values passed to include task but no values recorded in the tasks in
include_tasks. I'd like to be able to collect each iteration to test the
return code from the win_command and stdout in the main.yml.
tasks.yml
- name: Powershell
win_command: powershell.exe -executionpolicy bypass
c:\scripts\somescript.ps1
register: result
- name: test
debug:
msg: "{%if result.rc == 0 %} success {% else %} fail"
main.yml
usual stuff...
- name: loop
include_tasks: tasks.yml
register: loop_result
loop: "{{ list }}"
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/fdf28c14-555b-43f1-9da3-aa0036800fbdn%40googlegroups.com.