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

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/be4c4fbe-e743-f60b-21bd-502fbcdd2993%40ojkastl.de.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to