I'm using ansible-template (Jinja2), how can i get/find a value index of a list? For example:
listvar = ['abc', 'def', 'hij']
# i want get the index of value 'hij', it should get 2
i know use for
and set
, is there a other simple way?
I'm using ansible-template (Jinja2), how can i get/find a value index of a list? For example:
listvar = ['abc', 'def', 'hij']
# i want get the index of value 'hij', it should get 2
i know use for
and set
, is there a other simple way?