Well, Someone else might have a clearer answer, but the way you coded it, the task would be skipped if ln_mysql is not defined. Did you try adding some verbosity to the ansible-playbook command? When something like this happens to me, I go right for the -vvvv and that will usually point me in the right direction.
--John On Wed, Mar 16, 2022 at 7:08 PM subbamma natla <[email protected]> wrote: > 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] > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/CAJVhugJz5Wn%2BjokOWtAcN2p2guHTqM%2BrxV%2BztLYpQ-Zy%2BtYD_A%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CAJVhugJz5Wn%2BjokOWtAcN2p2guHTqM%2BrxV%2BztLYpQ-Zy%2BtYD_A%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAPAjob-EvJoi4fWg2QG0PFtDivsR_hZ%2BCg1SvGTyVnmYH1BQpA%40mail.gmail.com.
