community.general/lib/ansible/module_utils
Hugh Saunders f344ec463f Add LVM facts to setup module
This commit adds LinuxHardware.get_device_facts() and calls that from
.populate().

LVM facts are only gathered if the setup module is running as root and
the lvm utilities are available (tested by searching for 'vgs').

If the conditions are met, facts are set for each volume group and
logical volume.

Example:

Test LVM Data:
$ sudo vgs
  VG   #PV #LV #SN Attr   VSize VFree
  test   1   2   0 wz--n- 5.00g 2.00g
$ sudo lvs
  LV      VG   Attr      LSize Pool Origin Data%  Move Log Copy%  Convert
  testlv  test -wi-a---- 1.00g
  testlv2 test -wi-a---- 2.00g

Facts Returned:
$ ansible localhost -i /tmp/inv -m setup -a 'filter=ansible_lvm'
localhost | success >> {
    "ansible_facts": {
        "ansible_lvm": {
            "lvs": {
                "testlv": {
                    "size_g": "1.00",
                    "vg": "test"
                },
                "testlv2": {
                    "size_g": "2.00",
                    "vg": "test"
                }
            },
            "vgs": {
                "test": {
                    "free_g": "2.00",
                    "num_lvs": "2",
                    "num_pvs": "1",
                    "size_g": "5.00"
                }
            }
        }
    },
    "changed": false
}

Test as non-root:
$ ansible localhost -i /tmp/inv-user -m setup -a 'filter=ansible_lvm'
localhost | success >> {
    "ansible_facts": {},
    "changed": false
}

Test without lvm utilities available
$ sudo mv /sbin/vgs{,.bk}
$ ansible localhost -i /tmp/inv -m setup -a 'filter=ansible_lvm'
localhost | success >> {
    "ansible_facts": {},
    "changed": false
}
2015-07-28 07:46:01 +05:30
..
__init__.py
a10.py
basic.py Handle quoting of values in dict parameters 2015-07-27 12:31:05 -07:00
cloudstack.py cloudstack: fix domain name is not unique, use full path 2015-06-26 09:25:26 +02:00
database.py just a few spelling error changes 2015-04-28 09:36:42 -04:00
ec2.py Merge pull request #11591 from defionscode/boto3 2015-07-23 15:54:28 -04:00
f5.py Simplify Fully Qualified function 2015-06-03 21:19:11 +02:00
facts.py Add LVM facts to setup module 2015-07-28 07:46:01 +05:30
gce.py Google: allow for different libcloud provider to support upcoming DNS module 2014-10-29 19:57:46 +00:00
known_hosts.py Have known_hosts function use the url parameter instead of getting a specific attribute out of the module dict. 2014-12-04 11:39:35 -08:00
openstack.py Remove unneeded required_one_of for openstack 2015-05-29 13:09:45 -07:00
powershell.ps1 made md5 into generic checksum function that uses sha now 2015-07-14 07:28:32 -04:00
rax.py Prevent an empty error message 2015-03-10 11:30:28 -05:00
redhat.py
splitter.py
urls.py Python2.4 compat fix 2015-07-27 15:34:51 -07:00