Add conditional logic to variable files?

I’ve been using Ansible Galaxy roles from Jeff Geerling. In his Github READMEs he seems to say that you can override variable settings in his default/main.yml and vars/*.yml files by reproducing the desired settings in a /vars/main.yml file and then re-assigning them your desire values. This works well but there are times when I’d like to use the following logic in that file:

`

vars/main.yml

enable_setting: true

if enable_setting
foo: bar
else
baz: barf
`

Is this possible? I didn’t see this mentioned in the Ansible docs on Variables and Conditionals.

Thanks.

data files have no logic, but you can use a templated value instead:

foo: "{{ enabled_setting|ternary('bar', '') }}"
baz: "{{ enabled_setting|ternary('', 'barf') }}"