best practice to assign conditional variables, depending on --extra-vars values

Hi,

I´ve a “best practice” question of how to define conditional variables, depending on other variables:
The requirement is:

  • –extra-vars “extint_filter=regEx” should filter instances

  • –extra-vars “internalOnly=true” should filter instances by a ‘build-in’ filter,read from {{stage}} file

  • if both are passed, the ‘built-in’ filter wins

  • if nothing is passed, the filter defaults to “.*”, so all instances are selected

Actually I solved it like this:

`