Hi Lucio,
The filter would be evaluated first and then the not.
Consider below playbook :
---
- name: Parsing
hosts: localhost
gather_facts: no
vars:
- v1: hello
tasks:
- name: first condition
debug:
msg: First is true
when: not v1 | bool
- name: Second condition
debug:
msg: Second is true
when: not (v1 | bool)
Both the conditions in above playbook return TRUE as bool of "Hello" is FALSE and negate of FALSE is TRUE.
Now consider another playbook:
---
- name: Parsing2
hosts: localhost
gather_facts: no
vars:
- v1: hello
tasks:
- name: first condition
debug:
msg: First is true
when: not v1
- name: Second condition
debug:
msg: Second is true
when: not v1 | bool
In this playbook the first condition would return FALSE as presence of any string is TRUE and negate of TRUE is FALSE. Whereas in the second condition, the string is first parsed and filtered by bool filter for yaml-style ‘yes, on, true, false, False, Off, NO’ and other words and FALSE is returned as no such word is found. The negate of FALSE is TRUE.
Based on above two observations, it can be concluded that bool filter is evaluated first and then the not operator.
Therefore, to answer your second question: