I have a few output variables. Around 4 different types of error conditions are possible and a single successful condition, which I check using when
condition. But it is more of an if else if else if else condition. I don't want to even check the second, third and fourth condition if first condition becomes true and skip to final summary task.
How to implement this.
Ansible is a Configuration Management Tool with which you declare a state, ideally idempotent.
and a single successful condition, which I check using when condition.
Since there is one correct state, one would define that state in playbook only. There is no need for checks then.
Appart from that, with Conditionals
, if you have multiple conditions, you can group them with parentheses.
To achieve your goal you should have a look into turn ... if then logic into a boolean expression.
Furthermore, there are a lot Q&A here on SO which answered your question already.