Below playbook use conditional statement with operators in Ansible. When I run the playbook, it never takes/validates the condition instead it consider the last set_fact val
Fix your indentation. when
is not an argument of a set_fact
action, but of a task:
- name: SHMALL value for MEM less than 16G
set_fact:
shmall: 3670016
when: ansible_memtotal_mb|int <= 16384
- name: SHMALL value for MEM is between 16G and 32G
set_fact:
shmall: 7340032
when: ansible_memtotal_mb|int > 16384 and ansible_memtotal_mb|int <= 32768