local_action and register

Hi there

I have some troubles to get register variable from local_action. Here is what I have:

​Where you running that playbook in check mode?

Yes, I were running it in check mode.

​That's why the command tasks are skipped (they don't support check mode).
And then the variable doesn't get registered, which is why it fails in the
next step.

Serge​

" only_if: “$status.rc != 0"”

BTW, only if is extremely dated syntax. In 1.1 this was improved with when_integer, and in 1.2 (current development release but many many people run from source and it’s quite stable now) both only_if and when* are deprecated.

when: status:rc != 0

What you want in this case is actually:

when: status is defined and status.rc != 0

Ok, thanks everyone. I am very suspicious and always run check mode :slight_smile:

I am aware of only_if and when, but since both of them did not work, I left only_if.

Regarding outdated syntax - perhaps --syntax-check should warn about deprecated syntax? It’s not always possible to track all changes, but --syntax-check seems to be a godd way how to warn about them!?

Edgars

But as of today, July 9, 2013, the examples for the debug module are still using the only_if expression?

– Zack

Easily fixed with a pull request. I've been doing that for the docs I come across that are dated.

-jlk

I have a ticket on this already. Will get to it if there is not a pull request.