Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing SDA Size No Longer Working #226

Open
bjmaynard01 opened this issue Nov 10, 2020 · 2 comments
Open

Parsing SDA Size No Longer Working #226

bjmaynard01 opened this issue Nov 10, 2020 · 2 comments
Labels

Comments

@bjmaynard01
Copy link

I have the following lamdba statement in a custom csv template

{"title": "Disk1", "id": "disk1", "visible": True, "field": lambda h: host['ansible_facts'].get('ansible_devices').get('sda').get('size', '')},

This worked flawlessly previously, but now I am getting an error:

The reported error was: AttributeError: 'NoneType' object has no attribute 'get'

The full error was:

    Traceback (most recent call last):
      File "/root/inventory/env/bin/../lib/ansiblecmdb/ansible-cmdb.py", line 216, in <module>
        output = renderer.render(ansible.get_hosts(), params)
      File "/root/inventory/env/lib64/python3.6/site-packages/ansiblecmdb/render.py", line 42, in render
        return self._render_mako(hosts, vars)
      File "/root/inventory/env/lib64/python3.6/site-packages/ansiblecmdb/render.py", line 59, in _render_mako
        return template.render(hosts=hosts, **vars)
      File "/root/inventory/env/lib64/python3.6/site-packages/mako/template.py", line 476, in render
        return runtime._render(self, self.callable_, args, data)
      File "/root/inventory/env/lib64/python3.6/site-packages/mako/runtime.py", line 883, in _render
        **_kwargs_for_callable(callable_, data)
      File "/root/inventory/env/lib64/python3.6/site-packages/mako/runtime.py", line 920, in _render_context
        _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
      File "/root/inventory/env/lib64/python3.6/site-packages/mako/runtime.py", line 947, in _exec_template
        callable_(context, *args, **kwargs)
      File "/root/inventory/env/custom_csv.tpl", line 43, in render_body
        out_cols.append(col['field'](host))
      File "/root/inventory/env/custom_csv.tpl", line 14, in <lambda>
        {"title": "Disk1",        "id": "disk1",      "visible": True, "field": lambda h: host['ansible_facts'].get('ansible_devices').get('sda').get('size', '')},
    AttributeError: 'NoneType' object has no attribute 'get'

It still seems to work from some items in my inventory, but chokes at some point, and I'm at a loss as to where to look to try to isolate the root cause. Is there another way I should be getting the size of the sda disk?

The only thing that changed regarding inventory is upgrading ansible. Is this application no longer supported on newer versions of Ansible? Currently using Ansible 2.9.14

@bjmaynard01
Copy link
Author

Ansible Facts from last rendered host

{"ansible_facts": {"ansible_all_ipv4_addresses": ["10.5.12.235"], "ansible_all_ipv6_addresses": [], "ansible_apparmor": {"status": "disabled"}, "ansible_architecture": "x86_64", "ansible_bios_date": "04/01/2014", "ansible_bios_version": "1.9.1-5.el6", "ansible_cmdline": {"KEYBOARDTYPE": "pc", "KEYTABLE": "us", "LANG": "en_US.UTF-8", "SYSFONT": "latarcyrheb-sun16", "audit": "1", "crashkernel": "130M@48M", "quiet": true, "rd_LVM_LV": "vg_sys/lv_root", "rd_NO_DM": true, "rd_NO_LUKS": true, "rd_NO_MD": true, "rhgb": true, "ro": true, "root": "/dev/mapper/vg_sys-lv_root"}, "ansible_date_time": {"date": "2020-11-10", "day": "10", "epoch": "1605019488", "hour": "14", "iso8601": "2020-11-10T14:44:48Z", "iso8601_basic": "20201110T144448949149", "iso8601_basic_short": "20201110T144448", "iso8601_micro": "2020-11-10T14:44:48.949149Z", "minute": "44", "month": "11", "second": "48", "time": "14:44:48", "tz": "UTC", "tz_offset": "+0000", "weekday": "Tuesday", "weekday_number": "2", "weeknumber": "45", "year": "2020"}, "ansible_default_ipv4": {"address": "10.5.12.235", "alias": "eth0", "broadcast": "10.5.12.255", "gateway": "10.5.12.1", "interface": "eth0", "macaddress": "50:6b:8d:64:97:ae", "mtu": 1500, "netmask": "255.255.255.0", "network": "10.5.12.0", "type": "ether"}, "ansible_default_ipv6": {}, "ansible_device_links": {"ids": {"dm-0": ["dm-name-vg_sys-lv_root", "dm-uuid-LVM-uwDYE7fHJ8sd27Ow0o857eE1KLmWch1hkgBGy7pe16W37cRDLkSNkz0CceG76BrB"], "dm-1": ["dm-name-vg_sys-lv_swap", "dm-uuid-LVM-uwDYE7fHJ8sd27Ow0o857eE1KLmWch1hXY9RLOV95X5UksuhD6hAuDqFsZBQ64Xc"], "dm-2": ["dm-name-vg_sys-lv_home", "dm-uuid-LVM-uwDYE7fHJ8sd27Ow0o857eE1KLmWch1hn0dEPOAg60Kk560UVTYEL80kj5loMXck"], "dm-3": ["dm-name-vg_sys-lv_tmp", "dm-uuid-LVM-uwDYE7fHJ8sd27Ow0o857eE1KLmWch1heeLhQWMzdTzrQlXZ2tBALBGBahD8dw1o"], "dm-4": ["dm-name-vg_sys-lv_var", "dm-uuid-LVM-uwDYE7fHJ8sd27Ow0o857eE1KLmWch1hhPlRVGjxxQHWKG52mYlvqkxtQM2A3cSs"], "dm-5": ["dm-name-vg_sys-lv_var_log", "dm-uuid-LVM-uwDYE7fHJ8sd27Ow0o857eE1KLmWch1hhYHs029i2359EmRexV30lAk4tdynDWc0"], "dm-6": ["dm-name-vg_sys-lv_var_log_audit", "dm-uuid-LVM-uwDYE7fHJ8sd27Ow0o857eE1KLmWch1hpr2gdbLogbAoCMWMzbe34BjdtOHTMJBP"], "sda": ["scsi-1NUTANIX_NFS_2_0_550_03ddeee6_75c5_4cf5_8003_5debfaa8bc20"], "sda1": ["scsi-1NUTANIX_NFS_2_0_550_03ddeee6_75c5_4cf5_8003_5debfaa8bc20-part1"], "sda2": ["lvm-pv-uuid-YgmLNp-LsW8-s4K1-20dt-3hJw-YN6g-UMUnSB", "scsi-1NUTANIX_NFS_2_0_550_03ddeee6_75c5_4cf5_8003_5debfaa8bc20-part2"], "sda3": ["lvm-pv-uuid-28qrns-oDjs-OyFU-eDCQ-XAvf-Jlpp-N68K5a", "scsi-1NUTANIX_NFS_2_0_550_03ddeee6_75c5_4cf5_8003_5debfaa8bc20-part3"], "sr0": ["ata-QEMU_DVD-ROM_QM00001"]}, "labels": {}, "masters": {"sda2": ["dm-0", "dm-1", "dm-2", "dm-3", "dm-4", "dm-5", "dm-6"], "sda3": ["dm-0"]}, "uuids": {"dm-0": ["4d6a32dc-b3bd-475d-a5c0-a193197cf241"], "dm-1": ["cc033f6b-0804-4aa1-b3d3-9880b56a9051"], "dm-2": ["77b63833-c67c-4a75-a55e-289a22bdb621"], "dm-3": ["749fb906-7023-4073-be35-919d4f24027e"], "dm-4": ["d910fd08-bfc7-4938-a39f-83c0d5b7ada1"], "dm-5": ["3fb89f10-345f-4d1f-9881-e639576c4847"], "dm-6": ["06240f8f-2746-48f8-b82a-9a35fa0da9a7"], "sda1": ["1b17a0c6-5984-42bd-83e3-67f5b82f33c5"]}}, "ansible_devices": {"dm-0": {"holders": [], "host": "", "links": {"ids": ["dm-name-vg_sys-lv_root", "dm-uuid-LVM-uwDYE7fHJ8sd27Ow0o857eE1KLmWch1hkgBGy7pe16W37cRDLkSNkz0CceG76BrB"], "labels": [], "masters": [], "uuids": ["4d6a32dc-b3bd-475d-a5c0-a193197cf241"]}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "2080415744", "sectorsize": "512", "size": "992.02 GB", "support_discard": "1048576", "vendor": null, "virtual": 1}, "dm-1": {"holders": [], "host": "", "links": {"ids": ["dm-name-vg_sys-lv_swap", "dm-uuid-LVM-uwDYE7fHJ8sd27Ow0o857eE1KLmWch1hXY9RLOV95X5UksuhD6hAuDqFsZBQ64Xc"], "labels": [], "masters": [], "uuids": ["cc033f6b-0804-4aa1-b3d3-9880b56a9051"]}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "4128768", "sectorsize": "512", "size": "1.97 GB", "support_discard": "1048576", "vendor": null, "virtual": 1}, "dm-2": {"holders": [], "host": "", "links": {"ids": ["dm-name-vg_sys-lv_home", "dm-uuid-LVM-uwDYE7fHJ8sd27Ow0o857eE1KLmWch1hn0dEPOAg60Kk560UVTYEL80kj5loMXck"], "labels": [], "masters": [], "uuids": ["77b63833-c67c-4a75-a55e-289a22bdb621"]}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "2097152", "sectorsize": "512", "size": "1.00 GB", "support_discard": "1048576", "vendor": null, "virtual": 1}, "dm-3": {"holders": [], "host": "", "links": {"ids": ["dm-name-vg_sys-lv_tmp", "dm-uuid-LVM-uwDYE7fHJ8sd27Ow0o857eE1KLmWch1heeLhQWMzdTzrQlXZ2tBALBGBahD8dw1o"], "labels": [], "masters": [], "uuids": ["749fb906-7023-4073-be35-919d4f24027e"]}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "2097152", "sectorsize": "512", "size": "1.00 GB", "support_discard": "1048576", "vendor": null, "virtual": 1}, "dm-4": {"holders": [], "host": "", "links": {"ids": ["dm-name-vg_sys-lv_var", "dm-uuid-LVM-uwDYE7fHJ8sd27Ow0o857eE1KLmWch1hhPlRVGjxxQHWKG52mYlvqkxtQM2A3cSs"], "labels": [], "masters": [], "uuids": ["d910fd08-bfc7-4938-a39f-83c0d5b7ada1"]}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "4194304", "sectorsize": "512", "size": "2.00 GB", "support_discard": "1048576", "vendor": null, "virtual": 1}, "dm-5": {"holders": [], "host": "", "links": {"ids": ["dm-name-vg_sys-lv_var_log", "dm-uuid-LVM-uwDYE7fHJ8sd27Ow0o857eE1KLmWch1hhYHs029i2359EmRexV30lAk4tdynDWc0"], "labels": [], "masters": [], "uuids": ["3fb89f10-345f-4d1f-9881-e639576c4847"]}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "2097152", "sectorsize": "512", "size": "1.00 GB", "support_discard": "1048576", "vendor": null, "virtual": 1}, "dm-6": {"holders": [], "host": "", "links": {"ids": ["dm-name-vg_sys-lv_var_log_audit", "dm-uuid-LVM-uwDYE7fHJ8sd27Ow0o857eE1KLmWch1hpr2gdbLogbAoCMWMzbe34BjdtOHTMJBP"], "labels": [], "masters": [], "uuids": ["06240f8f-2746-48f8-b82a-9a35fa0da9a7"]}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "1048576", "sectorsize": "512", "size": "512.00 MB", "support_discard": "1048576", "vendor": null, "virtual": 1}, "loop0": {"holders": [], "host": "", "links": {"ids": [], "labels": [], "masters": [], "uuids": []}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "0", "sectorsize": "512", "size": "0.00 Bytes", "support_discard": "0", "vendor": null, "virtual": 1}, "loop1": {"holders": [], "host": "", "links": {"ids": [], "labels": [], "masters": [], "uuids": []}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "0", "sectorsize": "512", "size": "0.00 Bytes", "support_discard": "0", "vendor": null, "virtual": 1}, "loop2": {"holders": [], "host": "", "links": {"ids": [], "labels": [], "masters": [], "uuids": []}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "0", "sectorsize": "512", "size": "0.00 Bytes", "support_discard": "0", "vendor": null, "virtual": 1}, "loop3": {"holders": [], "host": "", "links": {"ids": [], "labels": [], "masters": [], "uuids": []}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "0", "sectorsize": "512", "size": "0.00 Bytes", "support_discard": "0", "vendor": null, "virtual": 1}, "loop4": {"holders": [], "host": "", "links": {"ids": [], "labels": [], "masters": [], "uuids": []}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "0", "sectorsize": "512", "size": "0.00 Bytes", "support_discard": "0", "vendor": null, "virtual": 1}, "loop5": {"holders": [], "host": "", "links": {"ids": [], "labels": [], "masters": [], "uuids": []}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "0", "sectorsize": "512", "size": "0.00 Bytes", "support_discard": "0", "vendor": null, "virtual": 1}, "loop6": {"holders": [], "host": "", "links": {"ids": [], "labels": [], "masters": [], "uuids": []}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "0", "sectorsize": "512", "size": "0.00 Bytes", "support_discard": "0", "vendor": null, "virtual": 1}, "loop7": {"holders": [], "host": "", "links": {"ids": [], "labels": [], "masters": [], "uuids": []}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "0", "sectorsize": "512", "size": "0.00 Bytes", "support_discard": "0", "vendor": null, "virtual": 1}, "ram0": {"holders": [], "host": "", "links": {"ids": [], "labels": [], "masters": [], "uuids": []}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "32768", "sectorsize": "512", "size": "16.00 MB", "support_discard": "0", "vendor": null, "virtual": 1}, "ram1": {"holders": [], "host": "", "links": {"ids": [], "labels": [], "masters": [], "uuids": []}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "32768", "sectorsize": "512", "size": "16.00 MB", "support_discard": "0", "vendor": null, "virtual": 1}, "ram10": {"holders": [], "host": "", "links": {"ids": [], "labels": [], "masters": [], "uuids": []}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "32768", "sectorsize": "512", "size": "16.00 MB", "support_discard": "0", "vendor": null, "virtual": 1}, "ram11": {"holders": [], "host": "", "links": {"ids": [], "labels": [], "masters": [], "uuids": []}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "32768", "sectorsize": "512", "size": "16.00 MB", "support_discard": "0", "vendor": null, "virtual": 1}, "ram12": {"holders": [], "host": "", "links": {"ids": [], "labels": [], "masters": [], "uuids": []}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "32768", "sectorsize": "512", "size": "16.00 MB", "support_discard": "0", "vendor": null, "virtual": 1}, "ram13": {"holders": [], "host": "", "links": {"ids": [], "labels": [], "masters": [], "uuids": []}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "32768", "sectorsize": "512", "size": "16.00 MB", "support_discard": "0", "vendor": null, "virtual": 1}, "ram14": {"holders": [], "host": "", "links": {"ids": [], "labels": [], "masters": [], "uuids": []}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "32768", "sectorsize": "512", "size": "16.00 MB", "support_discard": "0", "vendor": null, "virtual": 1}, "ram15": {"holders": [], "host": "", "links": {"ids": [], "labels": [], "masters": [], "uuids": []}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "32768", "sectorsize": "512", "size": "16.00 MB", "support_discard": "0", "vendor": null, "virtual": 1}, "ram2": {"holders": [], "host": "", "links": {"ids": [], "labels": [], "masters": [], "uuids": []}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "32768", "sectorsize": "512", "size": "16.00 MB", "support_discard": "0", "vendor": null, "virtual": 1}, "ram3": {"holders": [], "host": "", "links": {"ids": [], "labels": [], "masters": [], "uuids": []}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "32768", "sectorsize": "512", "size": "16.00 MB", "support_discard": "0", "vendor": null, "virtual": 1}, "ram4": {"holders": [], "host": "", "links": {"ids": [], "labels": [], "masters": [], "uuids": []}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "32768", "sectorsize": "512", "size": "16.00 MB", "support_discard": "0", "vendor": null, "virtual": 1}, "ram5": {"holders": [], "host": "", "links": {"ids": [], "labels": [], "masters": [], "uuids": []}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "32768", "sectorsize": "512", "size": "16.00 MB", "support_discard": "0", "vendor": null, "virtual": 1}, "ram6": {"holders": [], "host": "", "links": {"ids": [], "labels": [], "masters": [], "uuids": []}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "32768", "sectorsize": "512", "size": "16.00 MB", "support_discard": "0", "vendor": null, "virtual": 1}, "ram7": {"holders": [], "host": "", "links": {"ids": [], "labels": [], "masters": [], "uuids": []}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "32768", "sectorsize": "512", "size": "16.00 MB", "support_discard": "0", "vendor": null, "virtual": 1}, "ram8": {"holders": [], "host": "", "links": {"ids": [], "labels": [], "masters": [], "uuids": []}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "32768", "sectorsize": "512", "size": "16.00 MB", "support_discard": "0", "vendor": null, "virtual": 1}, "ram9": {"holders": [], "host": "", "links": {"ids": [], "labels": [], "masters": [], "uuids": []}, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "32768", "sectorsize": "512", "size": "16.00 MB", "support_discard": "0", "vendor": null, "virtual": 1}, "sda": {"holders": [], "host": "SCSI storage controller: Red Hat, Inc. Virtio SCSI", "links": {"ids": ["scsi-1NUTANIX_NFS_2_0_550_03ddeee6_75c5_4cf5_8003_5debfaa8bc20"], "labels": [], "masters": [], "uuids": []}, "model": "VDISK", "partitions": {"sda1": {"holders": [], "links": {"ids": ["scsi-1NUTANIX_NFS_2_0_550_03ddeee6_75c5_4cf5_8003_5debfaa8bc20-part1"], "labels": [], "masters": [], "uuids": ["1b17a0c6-5984-42bd-83e3-67f5b82f33c5"]}, "sectors": "1048576", "sectorsize": 512, "size": "512.00 MB", "start": "2048", "uuid": "1b17a0c6-5984-42bd-83e3-67f5b82f33c5"}, "sda2": {"holders": ["vg_sys-lv_root", "vg_sys-lv_swap", "vg_sys-lv_home", "vg_sys-lv_tmp", "vg_sys-lv_var", "vg_sys-lv_var_log", "vg_sys-lv_var_log_audit"], "links": {"ids": ["lvm-pv-uuid-YgmLNp-LsW8-s4K1-20dt-3hJw-YN6g-UMUnSB", "scsi-1NUTANIX_NFS_2_0_550_03ddeee6_75c5_4cf5_8003_5debfaa8bc20-part2"], "labels": [], "masters": ["dm-0", "dm-1", "dm-2", "dm-3", "dm-4", "dm-5", "dm-6"], "uuids": []}, "sectors": "208664576", "sectorsize": 512, "size": "99.50 GB", "start": "1050624", "uuid": null}, "sda3": {"holders": ["vg_sys-lv_root"], "links": {"ids": ["lvm-pv-uuid-28qrns-oDjs-OyFU-eDCQ-XAvf-Jlpp-N68K5a", "scsi-1NUTANIX_NFS_2_0_550_03ddeee6_75c5_4cf5_8003_5debfaa8bc20-part3"], "labels": [], "masters": ["dm-0"], "uuids": []}, "sectors": "1887425965", "sectorsize": 512, "size": "899.99 GB", "start": "209715200", "uuid": null}}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "cfq", "sectors": "2097152000", "sectorsize": "512", "size": "1000.00 GB", "support_discard": "1048576", "vendor": "NUTANIX", "virtual": 1}, "sr0": {"holders": [], "host": "IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]", "links": {"ids": ["ata-QEMU_DVD-ROM_QM00001"], "labels": [], "masters": [], "uuids": []}, "model": "QEMU DVD-ROM", "partitions": {}, "removable": "1", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "cfq", "sectors": "2097151", "sectorsize": "512", "size": "1024.00 MB", "support_discard": "0", "vendor": "QEMU", "virtual": 1}}, "ansible_distribution": "RedHat", "ansible_distribution_file_parsed": true, "ansible_distribution_file_path": "/etc/redhat-release", "ansible_distribution_file_search_string": "Red Hat", "ansible_distribution_file_variety": "RedHat", "ansible_distribution_major_version": "6", "ansible_distribution_release": "Santiago", "ansible_distribution_version": "6.10", "ansible_dns": {"nameservers": ["10.5.11.30", "10.5.0.51"], "search": ["tad.c8140.nrl.navy.mil"]}, "ansible_domain": "tad.c8140.nrl.navy.mil", "ansible_effective_group_id": 1987000000, "ansible_effective_user_id": 1987000008, "ansible_env": {"G_BROKEN_FILENAMES": "1", "HOME": "", "LANG": "C", "LC_ALL": "C", "LC_NUMERIC": "C", "LESSOPEN": "||/usr/bin/lesspipe.sh %s", "LOGNAME": "", "LS_COLORS": "rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.tbz=01;31:*.tbz2=01;31:*.bz=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36:", "MAIL": "/var/mail/bmaynard", "PATH": "/usr/local/bin:/bin:/usr/bin", "PWD": "/home/bmaynard", "SELINUX_LEVEL_REQUESTED": "", "SELINUX_ROLE_REQUESTED": "", "SELINUX_USE_CURRENT_RANGE": "", "SHELL": "/bin/bash", "SHLVL": "2", "SSH_ASKPASS": "/usr/libexec/openssh/gnome-ssh-askpass", "SSH_CLIENT": "10.5.11.39 59356 22", "SSH_CONNECTION": "10.5.11.39 59356 10.5.12.235 22", "SSH_TTY": "/dev/pts/0", "TERM": "xterm", "USER": "", "_": "/usr/bin/python"}, "ansible_eth0": {"active": true, "device": "eth0", "features": {"fcoe_mtu": "off [fixed]", "generic_receive_offload": "on", "generic_segmentation_offload": "on", "highdma": "on [fixed]", "large_receive_offload": "off [fixed]", "loopback": "off [fixed]", "netns_local": "off [fixed]", "ntuple_filters": "off [fixed]", "receive_hashing": "off [fixed]", "rx_checksumming": "on [fixed]", "rx_vlan_filter": "on [fixed]", "rx_vlan_offload": "off [fixed]", "scatter_gather": "on", "tcp_segmentation_offload": "on", "tx_checksum_fcoe_crc": "off [fixed]", "tx_checksum_ip_generic": "on", "tx_checksum_ipv4": "off [fixed]", "tx_checksum_ipv6": "off [fixed]", "tx_checksum_sctp": "off [fixed]", "tx_checksum_unneeded": "off [fixed]", "tx_checksumming": "on", "tx_fcoe_segmentation": "off [fixed]", "tx_gre_segmentation": "off [fixed]", "tx_gso_robust": "off [fixed]", "tx_lockless": "off [fixed]", "tx_scatter_gather": "on", "tx_scatter_gather_fraglist": "off [fixed]", "tx_tcp6_segmentation": "on", "tx_tcp_ecn_segmentation": "on", "tx_tcp_segmentation": "on", "tx_udp_tnl_segmentation": "off [fixed]", "tx_vlan_offload": "off [fixed]", "udp_fragmentation_offload": "on", "vlan_challenged": "off [fixed]"}, "hw_timestamp_filters": [], "ipv4": {"address": "10.5.12.235", "broadcast": "10.5.12.255", "netmask": "255.255.255.0", "network": "10.5.12.0"}, "macaddress": "50:6b:8d:64:97:ae", "module": "virtio_net", "mtu": 1500, "pciid": "virtio0", "promisc": false, "timestamping": ["rx_software", "software"], "type": "ether"}, "ansible_fibre_channel_wwn": [], "ansible_fips": false, "ansible_form_factor": "Other", "ansible_fqdn": "", "ansible_hostname": "", "ansible_hostnqn": "", "ansible_interfaces": ["lo", "eth0"], "ansible_is_chroot": false, "ansible_iscsi_iqn": "", "ansible_kernel": "2.6.32-754.28.1.el6.x86_64", "ansible_kernel_version": "#1 SMP Fri Jan 31 06:05:42 EST 2020", "ansible_lo": {"active": true, "device": "lo", "features": {"fcoe_mtu": "off [fixed]", "generic_receive_offload": "on", "generic_segmentation_offload": "on", "highdma": "on [fixed]", "large_receive_offload": "off [fixed]", "loopback": "on [fixed]", "netns_local": "on [fixed]", "ntuple_filters": "off [fixed]", "receive_hashing": "off [fixed]", "rx_checksumming": "on [fixed]", "rx_vlan_filter": "off [fixed]", "rx_vlan_offload": "off [fixed]", "scatter_gather": "on", "tcp_segmentation_offload": "on", "tx_checksum_fcoe_crc": "off [fixed]", "tx_checksum_ip_generic": "on [fixed]", "tx_checksum_ipv4": "off [fixed]", "tx_checksum_ipv6": "off [fixed]", "tx_checksum_sctp": "off [fixed]", "tx_checksum_unneeded": "off [fixed]", "tx_checksumming": "on", "tx_fcoe_segmentation": "off [fixed]", "tx_gre_segmentation": "off [fixed]", "tx_gso_robust": "off [fixed]", "tx_lockless": "on [fixed]", "tx_scatter_gather": "on [fixed]", "tx_scatter_gather_fraglist": "on [fixed]", "tx_tcp6_segmentation": "on", "tx_tcp_ecn_segmentation": "on", "tx_tcp_segmentation": "on", "tx_udp_tnl_segmentation": "off [fixed]", "tx_vlan_offload": "off [fixed]", "udp_fragmentation_offload": "on", "vlan_challenged": "on [fixed]"}, "hw_timestamp_filters": [], "ipv4": {"address": "127.0.0.1", "broadcast": "", "netmask": "255.0.0.0", "network": "127.0.0.0"}, "mtu": 65536, "promisc": false, "timestamping": ["rx_software", "software"], "type": "loopback"}, "ansible_local": {}, "ansible_lsb": {}, "ansible_machine": "x86_64", "ansible_machine_id": "d2a8d7bc77839610878bdd3f00000008", "ansible_memfree_mb": 1161, "ansible_memory_mb": {"nocache": {"free": 15084, "used": 966}, "real": {"free": 1161, "total": 16050, "used": 14889}, "swap": {"cached": 17, "free": 1971, "total": 2015, "used": 44}}, "ansible_memtotal_mb": 16050, "ansible_mounts": [{"block_available": 236351, "block_size": 4096, "block_total": 249830, "block_used": 13479, "device": "/dev/mapper/vg_sys-lv_tmp", "fstype": "ext4", "inode_available": 65521, "inode_total": 65536, "inode_used": 15, "mount": "/tmp", "options": "rw,nosuid,nodev", "size_available": 968093696, "size_total": 1023303680, "uuid": "749fb906-7023-4073-be35-919d4f24027e"}, {"block_available": 269493, "block_size": 4096, "block_total": 499668, "block_used": 230175, "device": "/dev/mapper/vg_sys-lv_var", "fstype": "ext4", "inode_available": 126943, "inode_total": 131072, "inode_used": 4129, "mount": "/var", "options": "rw,nodev", "size_available": 1103843328, "size_total": 2046640128, "uuid": "d910fd08-bfc7-4938-a39f-83c0d5b7ada1"}, {"block_available": 125821, "block_size": 4096, "block_total": 249830, "block_used": 124009, "device": "/dev/mapper/vg_sys-lv_home", "fstype": "ext4", "inode_available": 63715, "inode_total": 65536, "inode_used": 1821, "mount": "/home", "options": "rw,nodev", "size_available": 515362816, "size_total": 1023303680, "uuid": "77b63833-c67c-4a75-a55e-289a22bdb621"}, {"block_available": 96330, "block_size": 4096, "block_total": 124914, "block_used": 28584, "device": "/dev/sda1", "fstype": "ext4", "inode_available": 32717, "inode_total": 32768, "inode_used": 51, "mount": "/boot", "options": "rw,nodev", "size_available": 394567680, "size_total": 511647744, "uuid": "1b17a0c6-5984-42bd-83e3-67f5b82f33c5"}, {"block_available": 111618, "block_size": 4096, "block_total": 124914, "block_used": 13296, "device": "/dev/mapper/vg_sys-lv_var_log_audit", "fstype": "ext4", "inode_available": 32752, "inode_total": 32768, "inode_used": 16, "mount": "/var/log/audit", "options": "rw,nodev", "size_available": 457187328, "size_total": 511647744, "uuid": "06240f8f-2746-48f8-b82a-9a35fa0da9a7"}, {"block_available": 236962108, "block_size": 4096, "block_total": 255938366, "block_used": 18976258, "device": "/dev/mapper/vg_sys-lv_root", "fstype": "ext4", "inode_available": 64904025, "inode_total": 65019904, "inode_used": 115879, "mount": "/", "options": "rw", "size_available": 970596794368, "size_total": 1048323547136, "uuid": "4d6a32dc-b3bd-475d-a5c0-a193197cf241"}, {"block_available": 200178, "block_size": 4096, "block_total": 249830, "block_used": 49652, "device": "/dev/mapper/vg_sys-lv_var_log", "fstype": "ext4", "inode_available": 65362, "inode_total": 65536, "inode_used": 174, "mount": "/var/log", "options": "rw,nodev", "size_available": 819929088, "size_total": 1023303680, "uuid": "3fb89f10-345f-4d1f-9881-e639576c4847"}], "ansible_nodename": "db235", "ansible_os_family": "RedHat", "ansible_pkg_mgr": "yum", "ansible_proc_cmdline": {"KEYBOARDTYPE": "pc", "KEYTABLE": "us", "LANG": "en_US.UTF-8", "SYSFONT": "latarcyrheb-sun16", "audit": "1", "crashkernel": "130M@48M", "quiet": true, "rd_LVM_LV": ["vg_sys/lv_swap", "vg_sys/lv_root"], "rd_NO_DM": true, "rd_NO_LUKS": true, "rd_NO_MD": true, "rhgb": true, "ro": true, "root": "/dev/mapper/vg_sys-lv_root"}, "ansible_processor": ["0", "GenuineIntel", "Intel(R) Xeon(R) Silver 4114 CPU @ 2.20GHz", "1", "GenuineIntel", "Intel(R) Xeon(R) Silver 4114 CPU @ 2.20GHz", "2", "GenuineIntel", "Intel(R) Xeon(R) Silver 4114 CPU @ 2.20GHz", "3", "GenuineIntel", "Intel(R) Xeon(R) Silver 4114 CPU @ 2.20GHz"], "ansible_processor_cores": 2, "ansible_processor_count": 2, "ansible_processor_threads_per_core": 1, "ansible_processor_vcpus": 4, "ansible_product_name": "AHV", "ansible_product_serial": "NA", "ansible_product_uuid": "NA", "ansible_product_version": "RHEL 7.3.0 PC (i440FX + PIIX, 1996)", "ansible_python": {"executable": "/usr/bin/python", "has_sslcontext": false, "type": "CPython", "version": {"major": 2, "micro": 6, "minor": 6, "releaselevel": "final", "serial": 0}, "version_info": [2, 6, 6, "final", 0]}, "ansible_python_version": "2.6.6", "ansible_real_group_id": 1987000000, "ansible_real_user_id": 1987000008, "ansible_selinux": {"config_mode": "enforcing", "mode": "enforcing", "policyvers": 24, "status": "enabled", "type": "targeted"}, "ansible_selinux_python_present": true, "ansible_service_mgr": "upstart", "ansible_ssh_host_key_dsa_public": "", "ansible_swapfree_mb": 1971, "ansible_swaptotal_mb": 2015, "ansible_system": "Linux", "ansible_system_capabilities": [""], "ansible_system_capabilities_enforced": "True", "ansible_system_vendor": "Nutanix", "ansible_uptime_seconds": 17391054, "ansible_user_dir": "/home/bmaynard", "ansible_user_gecos": "", "ansible_user_gid": 1987000000, "ansible_user_id": "", "ansible_user_shell": "/bin/bash", "ansible_user_uid": 1987000008, "ansible_userspace_architecture": "x86_64", "ansible_userspace_bits": "64", "ansible_virtualization_role": "guest", "ansible_virtualization_type": "kvm", "discovered_interpreter_python": "/usr/bin/python", "gather_subset": ["all"], "module_setup": true}, "changed": false}

@fboender
Copy link
Owner

fboender commented Sep 4, 2021

I'm at a loss as to where to look to try to isolate the root cause.

Try adding a debug statement to your custom csv template. Something like the sys.stderr.write line in the example below. That should write out each hostname and the last one shown is the one with the problem.

writer.writerow(fieldnames)
for hostname, host in hosts.items():
  sys.stderr.write("{}\n".format(hostname))
  if 'ansible_facts' not in host:

Is there another way I should be getting the size of the sda disk?

It's always best to provide defaults when using .get(). So instead of:

# error prone
host['ansible_facts'].get('ansible_devices').get('sda').get('size', '')
# more resilient
host['ansible_facts'].get('ansible_devices', {}).get('sda', {}).get('size', '')

The only thing that changed regarding inventory is upgrading ansible.

It's difficult to say what the problem is here. Try adding the debug line I mentioned above and then inspecting the problematic fact file in a JSON editor. See if ansible_devices or sda is missing.

Is this application no longer supported on newer versions of Ansible? Currently using Ansible 2.9.14

We're running Ansible 2.11.3 and it's working fine, so 2.9.14 should also work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants