ceuser@deyu:~/ansible_pb$ vi blklvfs3.yml ceuser@deyu:~/ansible_pb$ grep hosts blklvfs3.yml - hosts: balancers
ceuser@deyu:~/ansible_pb$ cat blklvfs3.yml
---
- hosts: balancers
tasks:
......................
- ansible.builtin.debug:
msg: Volume group does not exist
when: ansible_lvm.vgs.fieldwork is undefined
ceuser@deyu:~/ansible_pb$ ansible-playbook blklvfs3.yml
PLAY [balancers] ***************************************************************
TASK [Gathering Facts] *********************************************************
ok: [kvm15]
TASK [Create a logical volume of 200m] *****************************************
skipping: [kvm15]
TASK [Create a ext4] ***********************************************************
skipping: [kvm15]
TASK [ansible.builtin.debug] ***************************************************
ok: [kvm15] => {
"msg": "Volume group does not exist"
}
PLAY RECAP *********************************************************************
kvm15 : ok=2 changed=0 unreachable=0 failed=0 skipped=2 rescued=0 ignored=0