Search code examples
linuxansibleredhatansible-facts

Why is my logical volume not showing in the ansible_lvm variable?


I have created a playbook to add a volume group (vg.services) and logical volume (lv_new). This results in the specified VG and LV being created as confirmed by the lsblk command:

[root@serverb student]# lsblk 
vda 
|---vda1 
|----vda2 
|----vda3 
vdb 
|--**vg.services-lv_new**

but when I query the ansible facts I get nothing back:

ansible serverb -m setup -a "filter=ansible_lvm"

serverb | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/libexec/platform-python"
    },
    "changed": false

what is going wrong here?


Solution

  • According ansible/lib/ansible/module_utils/facts/hardware/linux.py and Ansible Issue #17393

    "if running as root and lvm utils are available"

    you need to have high rights like root or become: true, as well LVM utils installed, otherwise

    "gather_facts silently skips lvm facts if lvm pkg not installed"