Hello,
I'm using ansible 1.2 and I would like to do the following:
- script: somescriptA.sh
register: resultA
- script: somescriptB.sh {{resultA.stdout}}
register: resultB
when: resultA.stdout.find("somemark") != -1
- script: somescriptC.sh
when: resultB.stdout|strip
Where the last script shall be executed when somescriptB succeed and produced non-empty output (that's why the |strip).
It happens the when the second action is skipped, the 3rd when:
fails (possibly because resultB is not defined) with something that
looks like a Jinja2 template error message:
"Conditional expression must evaluate to True or False: {% if resultB.stdout %} True {% else %} False {% endif %}"
I've tried also with the 3rd when:
resultB is defined
resultB.stdout != ''
resultB.stdout.strip() != ''
also without success.
What's the proper way of doing such conditional chaining?
Thanks in advance.
Luciano Cavalheiro