jeudi 24 septembre 2020

Define variable in Ansible according complex condition

I need to define a variable in ansible according several conditions

I know the syntax

VARtodefined: "Value1"

I know I have the same result with the following other syntax

VARtodefined: "'Value2'"

but I don't find the correct syntax for multiple condition (if-elsif-elsif-else)

I have for instance tried this without success

VARtodefined: "'Value3'"

If have tried variant with elif, elseif but also without success

In my specific case condition1 is OtherVar==XXX and condition2 OtherVar==YYY (so in both case it depends the value of OtherVar)

So I'm looking for a working solution for this

VARtodefined: "'Value3'"

If have found a workaround to achieve my goal but I'm interested to know the correct syntax for future projects

Aucun commentaire:

Enregistrer un commentaire