Ansible - ansible_lvm fact

The ansible_lvm fact contains a managed nodes (e.g. the target system) LVM (logical volume manager) information. You must be root to gather that LVM facts, thus you'll typically want to use the remote_user: root parameter.

For example, let's say you have the following playbook. 

---
- hosts: all
  remote_user: root
  tasks:
    - debug:
        var: ansible_lvm
...

 

Something like this should be returned.

  • lvs = logical volume size (like the lvdisplay command)
  • pvs = physical group size (like the pvdisplay command)
  • vgs = volume group size (like the vgdisplay command)
ok: [lab1.software.eng.us] => {
    "ansible_lvm": {
        "lvs": {
            "root": {
                "size_g": "7.00",
                "vg": "fedora_fedora"
            }
        },
        "pvs": {
            "/dev/sda2": {
                "free_g": "0",
                "size_g": "7.00",
                "vg": "fedora_fedora"
            }
        },
        "vgs": {
            "fedora_fedora": {
                "free_g": "0",
                "num_lvs": "1",
                "num_pvs": "1",
                "size_g": "7.00"
            }
        }
    }
}

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.





Please enter ef2e1 in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |