Re: [ansible-project] Re: How to avoid error when using a registered variable in check mode?

2017-01-17 Thread Johannes Kastl
On 16.01.17 10:32 Paul Tötterman wrote: >> 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. >> > > 3. only run the debug task when not in check_mode > 4. set

Re: [ansible-project] Re: How to avoid error when using a registered variable in check mode?

2017-01-17 Thread Johannes Kastl
On 15.01.17 19:43 Anthony Bond wrote: > - debug: msg="Here is the output of {{ my_variable.stdout }}" when: > my_variable is defined Thanks, I already had that in mind for the element skipped of my_variable: "2. Only run the debug task when my_variable.skipped is not defined." Johannes --

[ansible-project] Re: How to avoid error when using a registered variable in check mode?

2017-01-16 Thread Anthony Bond
Hello Johannes, You might want to use the Jinja2 defined test . Your debug task would look something like this. - debug: msg="Here is the output of {{ my_variable.stdout }}" when: my_variable is defined Just

[ansible-project] Re: How to avoid error when using a registered variable in check mode?

2017-01-16 Thread Paul Tötterman
> > 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. > 3. only run the debug task when not in check_mode 4. set some sort of default value when in check_mode