Re: [ansible-project] question on LVM exists or not

2022-03-16 Thread John Petro
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 - and that will usually point me in
the right direction.

--John

On Wed, Mar 16, 2022 at 7:08 PM subbamma natla 
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 ansible-project+unsubscr...@googlegroups.com.
> 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
> 
> .
>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAPAjob-EvJoi4fWg2QG0PFtDivsR_hZ%2BCg1SvGTyVnmYH1BQpA%40mail.gmail.com.


[ansible-project] question on LVM exists or not

2022-03-16 Thread subbamma natla
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 ansible-project+unsubscr...@googlegroups.com.
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.