---
- name: Playbook Name
hosts: all
gather_facts: yes
tasks:
- name: Set variables
vars:
VAR1: 5
VAR2: 10
VAR3: 0
VAR4: 100
when: (ansible_some_fact == "some_value1") or
(ansible_some_fact == "some_value2")
VAR4: 200
when: (ansible_some_fact == "some_value3") or
(ansible_some_fact == "some_value4")
size: "{{ 300 if 'string1’ in ansible_fact or 'string_2' in ansible_fact or 'string_3' in ansible_fact or 'string_4' in ansible_fact else 100 if 'string_5' in ansible_fact or 'string_6' in ansible_fact or 'string_7' in ansible_fact else 200 if 'string_8' in ansible_fact }}"