why am I getting output when " when: ansible_facts['lvm']['lvs']['lv_mysql'] is not defined"
---
- hosts: database
gather_facts: yes
tasks:
- name: check lv_mysql exists
debug:
msg: "LV_MYSQL not there"
when: ansible_facts['lvm']['lvs']['lv_mysql'] is not defined
- name: check lv_mysql exists
debug:
msg: "LV_MYSQL is there"
when: ansible_facts['lvm']['lvs']['lv_mysql'] is defined
output:
TASK [check lv_mysql exists] **********************************************************************************************************
ok: [mhost5] => {
"msg": "LV_MYSQL not there"
}
TASK [check lv_mysql exists] **********************************************************************************************************
skipping: [mhost5]