Hi,
I have a playbook that has to use the command module and registers its
output in a variable like so:
- command: do something here
register: my_variable
- debug: msg="Here is the output of {{ my_variable.stdout }}"
When running this in check_mode, the command task is skipped and the
variable my_variable does not have a object stdout. So ansible errors out.
How to avoid this? I got two thoughts, any hints or better practices
are highly welcome.
1. Set check_mode: no and always run the command task so the variable
always contains the stdout object.
2. Only run the debug task when my_variable.skipped is not defined.
Thanks in advance,
Johannes