Thanks Brian!  That totally makes sense, and I hadn't even thought about it
that way.  Thanks for the help, it is very much appreciated.

--John

On Thu, May 30, 2024 at 12:28 PM Brian Coca <[email protected]> wrote:

> First of all, both are valid ways of writing conditionals.
>
> From the execution standpoint, the main difference is that the list
> version will be evaluated in order, one at a time by Ansible passing
> each item to Jinja.  While the other one will be passed as one item
> into Jinja. This creates a minor change in efficiency depending on the
> amount of conditions and the likelyhood of failure, but for most cases
> (less than 100 conditionals) I would consider it negligible.
>
> From a practical standpoint, the 2nd form is easier to put into a
> variable and compose 'ANDed' conditions by adding to a list, you only
> need to ensure each condition's correctness, not the aggregated whole.
> The first form on the other hand supports 'OR' conditions also.
>
> In the end I would consider it a preference issue, though most Ansible
> users are used to the 2nd form and might get confused by the first,
> but that is only a consideration when/if sharing the content.
>
> --
> ----------
> Brian Coca (he/him/yo)
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CACVha7fDShTB-g-68uo%3DnMAqZXOVM2Oq3i%2BWUsGgM-nGXSNiRg%40mail.gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAPAjob8sruX%3DsYLdAcn2Cmb6-sVkm1p_g5K5MfHuxxuv1vddNA%40mail.gmail.com.

Reply via email to