James Kevin Joubert
James Kevin Joubert

Reputation: 13

Ansible Debug output with_items, filtered output

Made some progress on my original issue, so this question is being rephrased...

---
- name: gather ilo info
  hosts: localhost
  gather_facts: no
  vars:
    ILOip:
      - 192.168.1.100
  tasks:
    - name: gather ilo info
      hpilo_info:
        host: "{{ item }}"
        login: Administrator
        password: mypassword
      delegate_to: localhost
      register: ILOinfo
      with_items: "{{ ILOip }}"
    - debug: msg="{{ item['hw_system_serial'] }},{{ item['hw_health']['firmware_information']['iLO'] }},{{ item['hw_health']['firmware_information']['System ROM'] }}"
      with_items: "{{ ILOinfo.results }}"

Output from this playbook, is as follows:


PLAY [gather ilo info] **********************************************************************************************************************************

TASK [gather ilo info] **********************************************************************************************************************************
ok: [localhost] => (item=192.168.1.100)

TASK [debug] ********************************************************************************************************************************************
ok: [localhost] => (item={u'hw_bios_version': u'P89', u'module_hw': True, u'hw_eth2': {u'macaddress': u'E0:07:1B:F6:3B:D6', u'macaddress_dash': u'E0-07-1B-F6-3B-D6'}, u'hw_memory_total': u'1024 GB', u'hw_system_serial': u'USE123AHPA', u'hw_health': {u'nic_information': {u'Slot 1': {u'network_port': u'Port 2', u'status': u'OK', u'port_description': u'HP Ethernet 10Gb 2-port 530SFP+ Adapter', u'location': u'Slot 1', u'mac_address': u'8c:dc:d4:0c:44:f4', u'ip_address': u'N/A'}, u'Slot 4': {u'network_port': u'Port 2', u'status': u'OK', u'port_description': u'HP Ethernet 10Gb 2-port 530SFP+ Adapter', u'location': u'Slot 4', u'mac_address': u'8c:dc:d4:0c:4b:1c', u'ip_address': u'N/A'}, u'Embedded': {u'network_port': u'Port 4', u'status': u'Unknown', u'port_description': u'HP Ethernet 1Gb 4-port 331i Adapter', u'location': u'Embedded', u'mac_address': u'e0:07:1b:f6:3b:d7', u'ip_address': u'N/A'}}, u'health_at_a_glance': {u'network': {u'status': u'OK'}, u'battery': {u'status': u'OK'}, u'storage': {u'status': u'OK'}, u'fans': {u'status': u'OK', u'redundancy': u'Redundant'}, u'bios_hardware': {u'status': u'OK'}, u'memory': {u'status': u'OK'}, u'power_supplies': {u'status': u'OK', u'redundancy': u'Redundant'}, u'processor': {u'status': u'OK'}, u'temperature': {u'status': u'OK'}}, u'temperature': {u'28-LOM Card': {u'status': u'OK', u'critical': u'N/A', u'caution': [100, u'Celsius'], u'location': u'I/O Board', u'currentreading': [59, u'Celsius'], u'label': u'28-LOM Card'}, u'07-P2 DIMM 7-12': {u'status': u'OK', u'critical': u'N/A', u'caution': [89, u'Celsius'], u'location': u'Memory', u'currentreading': [47, u'Celsius'], u'label': u'07-P2 DIMM 7-12'}, u'16-VR P1 Mem': {u'status': u'OK', u'critical': [120, u'Celsius'], u'caution': [115, u'Celsius'], u'location': u'System', u'currentreading': [37, u'Celsius'], u'label': u'16-VR P1 Mem'}, u'41-iLO Zone': {u'status': u'OK', u'critical': [95, u'Celsius'], u'caution': [90, u'Celsius'], u'location': u'System', u'currentreading': [49, u'Celsius'], u'label': u'41-iLO Zone'}, u'10-Chipset': {u'status': u'OK', u'critical': u'N/A', u'caution': [105, u'Celsius'], u'location': u'System', u'currentreading': [50, u'Celsius'], u'label': u'10-Chipset'}, u'14-VR P2': {u'status': u'OK', u'critical': [120, u'Celsius'], u'caution': [115, u'Celsius'], u'location': u'System', u'currentreading': [49, u'Celsius'], u'label': u'14-VR P2'}, u'08-HD Max': {u'status': u'OK', u'critical': u'N/A', u'caution': [60, u'Celsius'], u'location': u'System', u'currentreading': [35, u'Celsius'], u'label': u'08-HD Max'}, u'06-P2 DIMM 1-6': {u'status': u'OK', u'critical': u'N/A', u'caution': [89, u'Celsius'], u'location': u'Memory', u'currentreading': [42, u'Celsius'], u'label': u'06-P2 DIMM 1-6'}, u'44-Fuse': {u'status': u'OK', u'critical': u'N/A', u'caution': [100, u'Celsius'], u'location': u'Power Supply', u'currentreading': [42, u'Celsius'], u'label': u'44-Fuse'}, u'24-PCI 4': {u'status': u'OK', u'critical': u'N/A', u'caution': [100, u'Celsius'], u'location': u'I/O Board', u'currentreading': [45, u'Celsius'], u'label': u'24-PCI 4'}, u'05-P1 DIMM 7-12': {u'status': u'OK', u'critical': u'N/A', u'caution': [89, u'Celsius'], u'location': u'Memory', u'currentreading': [44, u'Celsius'], u'label': u'05-P1 DIMM 7-12'}, u'36-PCI 6 Zone': {u'status': u'OK', u'critical': [75, u'Celsius'], u'caution': [70, u'Celsius'], u'location': u'I/O Board', u'currentreading': [40, u'Celsius'], u'label': u'36-PCI 6 Zone'}, u'38-I/O Zone': {u'status': u'OK', u'critical': [80, u'Celsius'], u'caution': [75, u'Celsius'], u'location': u'System', u'currentreading': [41, u'Celsius'], u'label': u'38-I/O Zone'}, u'25-PCI 5': {u'status': u'OK', u'critical': u'N/A', u'caution': [100, u'Celsius'], u'location': u'I/O Board', u'currentreading': [43, u'Celsius'], u'label': u'25-PCI 5'}, u'03-CPU 2': {u'status': u'OK', u'critical': u'N/A', u'caution': [70, u'Celsius'], u'location': u'CPU', u'currentreading': [40, u'Celsius'], u'label': u'03-CPU 2'}, u'37-HD Cntlr Zone': {u'status': u'OK', u'critical': u'N/A', u'caution': [75, u'Celsius'], u'location': u'I/O Board', u'currentreading': [54, u'Celsius'], u'label': u'37-HD Cntlr Zone'}, u'19-PS 1 Internal': {u'status': u'OK', u'critical': u'N/A', u'caution': u'N/A', u'location': u'Power Supply', u'currentreading': [40, u'Celsius'], u'label': u'19-PS 1 Internal'}, u'21-PCI 1': {u'status': u'OK', u'critical': u'N/A', u'caution': [100, u'Celsius'], u'location': u'I/O Board', u'currentreading': [49, u'Celsius'], u'label': u'21-PCI 1'}, u'30-Front Ambient': {u'status': u'OK', u'critical': u'N/A', u'caution': [65, u'Celsius'], u'location': u'Ambient', u'currentreading': [31, u'Celsius'], u'label': u'30-Front Ambient'}, u'33-PCI 3 Zone.': {u'status': u'OK', u'critical': [75, u'Celsius'], u'caution': [70, u'Celsius'], u'location': u'I/O Board', u'currentreading': [43, u'Celsius'], u'label': u'33-PCI 3 Zone.'}, u'34-PCI 4 Zone': {u'status': u'OK', u'critical': [75, u'Celsius'], u'caution': [70, u'Celsius'], u'location': u'I/O Board', u'currentreading': [40, u'Celsius'], u'label': u'34-PCI 4 Zone'}, u'02-CPU 1': {u'status': u'OK', u'critical': u'N/A', u'caution': [70, u'Celsius'], u'location': u'CPU', u'currentreading': [45, u'Celsius'], u'label': u'02-CPU 1'}, u'32-PCI 2 Zone.': {u'status': u'OK', u'critical': [75, u'Celsius'], u'caution': [70, u'Celsius'], u'location': u'I/O Board', u'currentreading': [43, u'Celsius'], u'label': u'32-PCI 2 Zone.'}, u'27-HD Controller': {u'status': u'OK', u'critical': u'N/A', u'caution': [100, u'Celsius'], u'location': u'I/O Board', u'currentreading': [70, u'Celsius'], u'label': u'27-HD Controller'}, u'23-PCI 3': {u'status': u'Not Installed', u'critical': u'N/A', u'caution': u'N/A', u'location': u'I/O Board', u'currentreading': u'N/A', u'label': u'23-PCI 3'}, u'31-PCI 1 Zone.': {u'status': u'OK', u'critical': [75, u'Celsius'], u'caution': [70, u'Celsius'], u'location': u'I/O Board', u'currentreading': [42, u'Celsius'], u'label': u'31-PCI 1 Zone.'}, u'22-PCI 2': {u'status': u'OK', u'critical': u'N/A', u'caution': [100, u'Celsius'], u'location': u'I/O Board', u'currentreading': [45, u'Celsius'], u'label': u'22-PCI 2'}, u'15-VR P1 Mem': {u'status': u'OK', u'critical': [120, u'Celsius'], u'caution': [115, u'Celsius'], u'location': u'System', u'currentreading': [39, u'Celsius'], u'label': u'15-VR P1 Mem'}, u'11-PS 1 Inlet': {u'status': u'OK', u'critical': u'N/A', u'caution': u'N/A', u'location': u'Power Supply', u'currentreading': [31, u'Celsius'], u'label': u'11-PS 1 Inlet'}, u'26-PCI 6': {u'status': u'Not Installed', u'critical': u'N/A', u'caution': u'N/A', u'location': u'I/O Board', u'currentreading': u'N/A', u'label': u'26-PCI 6'}, u'04-P1 DIMM 1-6': {u'status': u'OK', u'critical': u'N/A', u'caution': [89, u'Celsius'], u'location': u'Memory', u'currentreading': [47, u'Celsius'], u'label': u'04-P1 DIMM 1-6'}, u'13-VR P1': {u'status': u'OK', u'critical': [120, u'Celsius'], u'caution': [115, u'Celsius'], u'location': u'System', u'currentreading': [51, u'Celsius'], u'label': u'13-VR P1'}, u'42-Rear HD Max': {u'status': u'Not Installed', u'critical': u'N/A', u'caution': u'N/A', u'location': u'System', u'currentreading': u'N/A', u'label': u'42-Rear HD Max'}, u'18-VR P2 Mem': {u'status': u'OK', u'critical': [120, u'Celsius'], u'caution': [115, u'Celsius'], u'location': u'System', u'currentreading': [38, u'Celsius'], u'label': u'18-VR P2 Mem'}, u'35-PCI 5 Zone': {u'status': u'OK', u'critical': [75, u'Celsius'], u'caution': [70, u'Celsius'], u'location': u'I/O Board', u'currentreading': [41, u'Celsius'], u'label': u'35-PCI 5 Zone'}, u'40-Battery Zone': {u'status': u'OK', u'critical': [80, u'Celsius'], u'caution': [75, u'Celsius'], u'location': u'System', u'currentreading': [43, u'Celsius'], u'label': u'40-Battery Zone'}, u'39-P/S 2 Zone': {u'status': u'OK', u'critical': u'N/A', u'caution': [70, u'Celsius'], u'location': u'System', u'currentreading': [43, u'Celsius'], u'label': u'39-P/S 2 Zone'}, u'01-Inlet Ambient': {u'status': u'OK', u'critical': [50, u'Celsius'], u'caution': [42, u'Celsius'], u'location': u'Ambient', u'currentreading': [13, u'Celsius'], u'label': u'01-Inlet Ambient'}, u'43-Storage Batt': {u'status': u'OK', u'critical': u'N/A', u'caution': [60, u'Celsius'], u'location': u'System', u'currentreading': [18, u'Celsius'], u'label': u'43-Storage Batt'}, u'09-Exp Bay Drive': {u'status': u'Not Installed', u'critical': u'N/A', u'caution': u'N/A', u'location': u'System', u'currentreading': u'N/A', u'label': u'09-Exp Bay Drive'}, u'17-VR P2 Mem': {u'status': u'OK', u'critical': [120, u'Celsius'], u'caution': [115, u'Celsius'], u'location': u'System', u'currentreading': [39, u'Celsius'], u'label': u'17-VR P2 Mem'}, u'20-PS 2 Internal': {u'status': u'OK', u'critical': u'N/A', u'caution': u'N/A', u'location': u'Power Supply', u'currentreading': [45, u'Celsius'], u'label': u'20-PS 2 Internal'}, u'29-LOM': {u'status': u'Not Installed', u'critical': u'N/A', u'caution': u'N/A', u'location': u'System', u'currentreading': u'N/A', u'label': u'29-LOM'}, u'12-PS 2 Inlet': {u'status': u'OK', u'critical': u'N/A', u'caution': u'N/A', u'location': u'Power Supply', u'currentreading': [39, u'Celsius'], u'label': u'12-PS 2 Inlet'}}, u'storage': {u'Controller on System Board': {u'status': u'OK', u'controller_status': u'OK', u'encryption_status': u'Not Enabled', u'encryption_csp_status': u'OK', u'logical_drives': [{u'status': u'OK', u'logical_drive_type': u'Data LUN', u'capacity': u'372 GiB', u'encryption_status': u'Not Encrypted', u'fault_tolerance': u'RAID 1/RAID 1+0', u'physical_drives': [{u'status': u'OK', u'capacity': u'372 GiB', u'encryption_status': u'Not Encrypted', u'fw_version': u'HPD8', u'label': u'Port 1I Box 3 Bay 2', u'drive_configuration': u'Configured', u'location': u'Port 1I Box 3 Bay 2', u'serial_number': u'S2GYNA0HB01344', u'marketing_capacity': u'400 GB', u'model': u'MO0400JFFCF', u'media_type': u'SSD'}, {u'status': u'OK', u'capacity': u'372 GiB', u'encryption_status': u'Not Encrypted', u'fw_version': u'HPD8', u'label': u'Port 1I Box 3 Bay 1', u'drive_configuration': u'Configured', u'location': u'Port 1I Box 3 Bay 1', u'serial_number': u'S2GYNA0HB01572', u'marketing_capacity': u'400 GB', u'model': u'MO0400JFFCF', u'media_type': u'SSD'}], u'label': u'01'}], u'fw_version': u'7.00', u'label': u'Controller on System Board', u'drive_enclosures': [{u'status': u'OK', u'drive_bay': 4, u'label': u'Port 1I Box 3'}, {u'status': u'OK', u'drive_bay': 4, u'label': u'Port 2I Box 0'}], u'serial_number': u'PDNLH0BRH481YC', u'model': u'Smart Array P440ar Controller', u'encryption_self_test_status': u'OK'}}, u'storage_discovery_status': u'Discovery Complete', u'fans': {u'Fan 2': {u'status': u'OK', u'speed': [19, u'Percentage'], u'zone': u'System', u'label': u'Fan 2'}, u'Fan 3': {u'status': u'OK', u'speed': [16, u'Percentage'], u'zone': u'System', u'label': u'Fan 3'}, u'Fan 1': {u'status': u'OK', u'speed': [16, u'Percentage'], u'zone': u'System', u'label': u'Fan 1'}, u'Fan 6': {u'status': u'OK', u'speed': [11, u'Percentage'], u'zone': u'System', u'label': u'Fan 6'}, u'Fan 4': {u'status': u'OK', u'speed': [11, u'Percentage'], u'zone': u'System', u'label': u'Fan 4'}, u'Fan 5': {u'status': u'OK', u'speed': [13, u'Percentage'], u'zone': u'System', u'label': u'Fan 5'}}, u'power_supply_summary': {u'power_system_redundancy': u'Redundant', u'present_power_reading': u'318 Watts', u'power_management_controller_firmware_version': u'1.0.9', u'high_efficiency_mode': u'Balanced', u'hp_power_discovery_services_redundancy_status': u'N/A'}, u'memory': {u'memory_details': {u'CPU_2': {u'socket 3': {u'status': u'Not Present', u'socket': 3, u'ranks': u'N/A', u'technology': u'N/A', u'part': {u'number': u'N/A'}, u'frequency': u'N/A', u'minimum_voltage': u'N/A', u'hp_smart_memory': u'N/A', u'type': u'N/A', u'size': u'N/A'}, u'socket 2': {u'status': u'Good, In Use', u'socket': 2, u'ranks': 4, u'technology': u'LRDIMM', u'part': {u'number': u'809085-091'}, u'frequency': u'2400 MHz', u'minimum_voltage': u'1.20 v', u'hp_smart_memory': u'Yes', u'type': u'DIMM DDR4', u'size': u'65536 MB'}, u'socket 1': {u'status': u'Good, In Use', u'socket': 1, u'ranks': 4, u'technology': u'LRDIMM', u'part': {u'number': u'809085-091'}, u'frequency': u'2400 MHz', u'minimum_voltage': u'1.20 v', u'hp_smart_memory': u'Yes', u'type': u'DIMM DDR4', u'size': u'65536 MB'}, u'socket 8': {u'status': u'Good, In Use', u'socket': 8, u'ranks': 4, u'technology': u'LRDIMM', u'part': {u'number': u'809085-091'}, u'frequency': u'2400 MHz', u'minimum_voltage': u'1.20 v', u'hp_smart_memory': u'Yes', u'type': u'DIMM DDR4', u'size': u'65536 MB'}, u'socket 7': {u'status': u'Not Present', u'socket': 7, u'ranks': u'N/A', u'technology': u'N/A', u'part': {u'number': u'N/A'}, u'frequency': u'N/A', u'minimum_voltage': u'N/A', u'hp_smart_memory': u'N/A', u'type': u'N/A', u'size': u'N/A'}, u'socket 12': {u'status': u'Good, In Use', u'socket': 12, u'ranks': 4, u'technology': u'LRDIMM', u'part': {u'number': u'809085-091'}, u'frequency': u'2400 MHz', u'minimum_voltage': u'1.20 v', u'hp_smart_memory': u'Yes', u'type': u'DIMM DDR4', u'size': u'65536 MB'}, u'socket 5': {u'status': u'Good, In Use', u'socket': 5, u'ranks': 4, u'technology': u'LRDIMM', u'part': {u'number': u'809085-091'}, u'frequency': u'2400 MHz', u'minimum_voltage': u'1.20 v', u'hp_smart_memory': u'Yes', u'type': u'DIMM DDR4', u'size': u'65536 MB'}, u'socket 10': {u'status': u'Not Present', u'socket': 10, u'ranks': u'N/A', u'technology': u'N/A', u'part': {u'number': u'N/A'}, u'frequency': u'N/A', u'minimum_voltage': u'N/A', u'hp_smart_memory': u'N/A', u'type': u'N/A', u'size': u'N/A'}, u'socket 9': {u'status': u'Good, In Use', u'socket': 9, u'ranks': 4, u'technology': u'LRDIMM', u'part': {u'number': u'809085-091'}, u'frequency': u'2400 MHz', u'minimum_voltage': u'1.20 v', u'hp_smart_memory': u'Yes', u'type': u'DIMM DDR4', u'size': u'65536 MB'}, u'socket 4': {u'status': u'Good, In Use', u'socket': 4, u'ranks': 4, u'technology': u'LRDIMM', u'part': {u'number': u'809085-091'}, u'frequency': u'2400 MHz', u'minimum_voltage': u'1.20 v', u'hp_smart_memory': u'Yes', u'type': u'DIMM DDR4', u'size': u'65536 MB'}, u'socket 11': {u'status': u'Good, In Use', u'socket': 11, u'ranks': 4, u'technology': u'LRDIMM', u'part': {u'number': u'809085-091'}, u'frequency': u'2400 MHz', u'minimum_voltage': u'1.20 v', u'hp_smart_memory': u'Yes', u'type': u'DIMM DDR4', u'size': u'65536 MB'}, u'socket 6': {u'status': u'Not Present', u'socket': 6, u'ranks': u'N/A', u'technology': u'N/A', u'part': {u'number': u'N/A'}, u'frequency': u'N/A', u'minimum_voltage': u'N/A', u'hp_smart_memory': u'N/A', u'type': u'N/A', u'size': u'N/A'}}, u'CPU_1': {u'socket 3': {u'status': u'Not Present', u'socket': 3, u'ranks': u'N/A', u'technology': u'N/A', u'part': {u'number': u'N/A'}, u'frequency': u'N/A', u'minimum_voltage': u'N/A', u'hp_smart_memory': u'N/A', u'type': u'N/A', u'size': u'N/A'}, u'socket 2': {u'status': u'Good, In Use', u'socket': 2, u'ranks': 4, u'technology': u'LRDIMM', u'part': {u'number': u'809085-091'}, u'frequency': u'2400 MHz', u'minimum_voltage': u'1.20 v', u'hp_smart_memory': u'Yes', u'type': u'DIMM DDR4', u'size': u'65536 MB'}, u'socket 1': {u'status': u'Good, In Use', u'socket': 1, u'ranks': 4, u'technology': u'LRDIMM', u'part': {u'number': u'809085-091'}, u'frequency': u'2400 MHz', u'minimum_voltage': u'1.20 v', u'hp_smart_memory': u'Yes', u'type': u'DIMM DDR4', u'size': u'65536 MB'}, u'socket 8': {u'status': u'Good, In Use', u'socket': 8, u'ranks': 4, u'technology': u'LRDIMM', u'part': {u'number': u'809085-091'}, u'frequency': u'2400 MHz', u'minimum_voltage': u'1.20 v', u'hp_smart_memory': u'Yes', u'type': u'DIMM DDR4', u'size': u'65536 MB'}, u'socket 7': {u'status': u'Not Present', u'socket': 7, u'ranks': u'N/A', u'technology': u'N/A', u'part': {u'number': u'N/A'}, u'frequency': u'N/A', u'minimum_voltage': u'N/A', u'hp_smart_memory': u'N/A', u'type': u'N/A', u'size': u'N/A'}, u'socket 12': {u'status': u'Good, In Use', u'socket': 12, u'ranks': 4, u'technology': u'LRDIMM', u'part': {u'number': u'809085-091'}, u'frequency': u'2400 MHz', u'minimum_voltage': u'1.20 v', u'hp_smart_memory': u'Yes', u'type': u'DIMM DDR4', u'size': u'65536 MB'}, u'socket 5': {u'status': u'Good, In Use', u'socket': 5, u'ranks': 4, u'technology': u'LRDIMM', u'part': {u'number': u'809085-091'}, u'frequency': u'2400 MHz', u'minimum_voltage': u'1.20 v', u'hp_smart_memory': u'Yes', u'type': u'DIMM DDR4', u'size': u'65536 MB'}, u'socket 10': {u'status': u'Not Present', u'socket': 10, u'ranks': u'N/A', u'technology': u'N/A', u'part': {u'number': u'N/A'}, u'frequency': u'N/A', u'minimum_voltage': u'N/A', u'hp_smart_memory': u'N/A', u'type': u'N/A', u'size': u'N/A'}, u'socket 9': {u'status': u'Good, In Use', u'socket': 9, u'ranks': 4, u'technology': u'LRDIMM', u'part': {u'number': u'809085-091'}, u'frequency': u'2400 MHz', u'minimum_voltage': u'1.20 v', u'hp_smart_memory': u'Yes', u'type': u'DIMM DDR4', u'size': u'65536 MB'}, u'socket 4': {u'status': u'Good, In Use', u'socket': 4, u'ranks': 4, u'technology': u'LRDIMM', u'part': {u'number': u'809085-091'}, u'frequency': u'2400 MHz', u'minimum_voltage': u'1.20 v', u'hp_smart_memory': u'Yes', u'type': u'DIMM DDR4', u'size': u'65536 MB'}, u'socket 11': {u'status': u'Good, In Use', u'socket': 11, u'ranks': 4, u'technology': u'LRDIMM', u'part': {u'number': u'809085-091'}, u'frequency': u'2400 MHz', u'minimum_voltage': u'1.20 v', u'hp_smart_memory': u'Yes', u'type': u'DIMM DDR4', u'size': u'65536 MB'}, u'socket 6': {u'status': u'Not Present', u'socket': 6, u'ranks': u'N/A', u'technology': u'N/A', u'part': {u'number': u'N/A'}, u'frequency': u'N/A', u'minimum_voltage': u'N/A', u'hp_smart_memory': u'N/A', u'type': u'N/A', u'size': u'N/A'}}}, u'advanced_memory_protection': {u'configured_amp_mode': u'Advanced ECC', u'available_amp_modes': u'Advanced ECC, Online Spare (Rank Sparing), Intrasocket Mirroring', u'amp_mode_status': u'Advanced ECC'}, u'memory_details_summary': {u'cpu_2': {u'operating_frequency': u'2400 MHz', u'operating_voltage': u'1.20 v', u'total_memory_size': u'512 GB', u'number_of_sockets': 12}, u'cpu_1': {u'operating_frequency': u'2400 MHz', u'operating_voltage': u'1.20 v', u'total_memory_size': u'512 GB', u'number_of_sockets': 12}}}, u'firmware_information': {u'Smart Array P440ar Controller': u'7.00', u'Intelligent Platform Abstraction Data': u'27.01', u'HP SN1000Q 16Gb Dual Port FC HBA': u'06.02.01', u'Redundant System ROM': u'P89 v2.72 (03/25/2019)', u'HP FlexFabric 10Gb 2-port 534FLR-SFP+ Adapter': u'7.18.26', u'System Programmable Logic Device': u'Version 0x34', u'HPE Smart Storage Battery 1 Firmware': u'2.1', u'Power Management Controller Firmware': u'1.0.9', u'HP Ethernet 1Gb 4-port 331i Adapter': u'20.14.57', u'Server Platform Services (SPS) Firmware': u'3.1.3.21.0', u'Power Management Controller FW Bootloader': u'1.0', u'SAS Programmable Logic Device': u'Version 0x03', u'System ROM': u'P89 v2.76 (10/21/2019)', u'Intelligent Provisioning': u'2.50.164', u'iLO': u'2.75 Aug 13 2020', u'HP Ethernet 10Gb 2-port 530SFP+ Adapter': u'7.18.26'}, u'power_supplies': {u'Battery 1': {u'status': u'OK', u'capacity': u'96 Watts', u'label': u'Battery 1', u'spare': u'871264-001', u'serial_number': u'6WEJD0GB2533D9', u'model': u'727258-B21', u'firmware_version': u'2.1', u'present': u'Yes'}, u'Power Supply 2': {u'status': u'Good, In Use', u'capacity': u'500 Watts', u'pds': u'No', u'label': u'Power Supply 2', u'hotplug_capable': u'Yes', u'spare': u'754377-001', u'serial_number': u'5DMVV0C4D413DY', u'model': u'720478-B21', u'firmware_version': u'1.00', u'present': u'Yes'}, u'Power Supply 1': {u'status': u'Good, In Use', u'capacity': u'500 Watts', u'pds': u'No', u'label': u'Power Supply 1', u'hotplug_capable': u'Yes', u'spare': u'754377-001', u'serial_number': u'5DMVV0C4D41254', u'model': u'720478-B21', u'firmware_version': u'1.00', u'present': u'Yes'}}, u'vrm': None, u'processors': {u'Proc 2': {u'status': u'OK', u'internal_l1_cache': u'896 KB', u'name': u'Intel(R) Xeon(R) CPU E5-2690 v4 @ 2.60GHz', u'memory_technology': u'64-bit Capable', u'internal_l2_cache': u'3584 KB', u'label': u'Proc 2', u'internal_l3_cache': u'35840 KB', u'speed': u'2600 MHz', u'execution_technology': u'14/14 cores; 28 threads'}, u'Proc 1': {u'status': u'OK', u'internal_l1_cache': u'896 KB', u'name': u'Intel(R) Xeon(R) CPU E5-2690 v4 @ 2.60GHz', u'memory_technology': u'64-bit Capable', u'internal_l2_cache': u'3584 KB', u'label': u'Proc 1', u'internal_l3_cache': u'35840 KB', u'speed': u'2600 MHz', u'execution_technology': u'14/14 cores; 28 threads'}}}, u'hw_eth3': {u'macaddress': u'E0:07:1B:F6:3B:D7', u'macaddress_dash': u'E0-07-1B-F6-3B-D7'}, u'hw_memory_details_summary': {u'cpu_2': {u'operating_frequency': u'2400 MHz', u'operating_voltage': u'1.20 v', u'total_memory_size': u'512 GB', u'number_of_sockets': 12}, u'cpu_1': {u'operating_frequency': u'2400 MHz', u'operating_voltage': u'1.20 v', u'total_memory_size': u'512 GB', u'number_of_sockets': 12}}, u'ansible_loop_var': u'item', u'item': u'2001:4888:a05:3152:e0:ff2::201', u'hw_product_name': u'ProLiant DL380 Gen9', u'hw_eth6': {u'macaddress': u'8C:DC:D4:0C:44:F0', u'macaddress_dash': u'8C-DC-D4-0C-44-F0'}, u'changed': False, u'hw_bios_date': u'10/21/2019', u'failed': False, u'hw_eth8': {u'macaddress': u'8C:DC:D4:0C:4B:18', u'macaddress_dash': u'8C-DC-D4-0C-4B-18'}, u'hw_eth9': {u'macaddress': u'8C:DC:D4:0C:4B:1C', u'macaddress_dash': u'8C-DC-D4-0C-4B-1C'}, u'hw_eth_ilo': {u'macaddress': u'E0:07:1B:FA:63:D4', u'macaddress_dash': u'E0-07-1B-FA-63-D4'}, u'invocation': {u'module_args': {u'host': u'2001:4888:a05:3152:e0:ff2::201', u'password': u'VALUE_SPECIFIED_IN_NO_LOG_PARAMETER', u'ssl_version': u'TLSv1', u'login': u'Administrator'}}, u'hw_uuid': u'719064USE704AHPA', u'hw_eth0': {u'macaddress': u'E0:07:1B:F6:3B:D4', u'macaddress_dash': u'E0-07-1B-F6-3B-D4'}, u'hw_eth1': {u'macaddress': u'E0:07:1B:F6:3B:D5', u'macaddress_dash': u'E0-07-1B-F6-3B-D5'}, u'hw_product_uuid': u'30393137-3436-5355-4537-303441485041', u'hw_eth7': {u'macaddress': u'8C:DC:D4:0C:44:F4', u'macaddress_dash': u'8C-DC-D4-0C-44-F4'}, u'hw_eth4': {u'macaddress': u'14:02:EC:44:1A:18', u'macaddress_dash': u'14-02-EC-44-1A-18'}, u'hw_eth5': {u'macaddress': u'14:02:EC:44:1A:1C', u'macaddress_dash': u'14-02-EC-44-1A-1C'}}) =>
  msg: USE123AHPA,2.75 Aug 13 2020,P89 v2.76 (10/21/2019)

How do I filter this output to just get the last line?

Without looping this, I only get the last line.
Adding the loop generates the entire output and then the filtered output.
I will be looping this over a few dozen IP addresses and only want the filtered, not full output for the item.

Upvotes: 1

Views: 1833

Answers (2)

James Kevin Joubert
James Kevin Joubert

Reputation: 13

I may have found a solution by removing the "debug" task and adding a "lineinfile" task...

    - name: append
      lineinfile:
        dest: /tmp/ILOinfo
        create: yes
        line: "Host= {{ item['invocation']['module_args']['host'] }},SN= {{ item['hw_system_serial'] }},ILOfw= {{ item['hw_health']['firmware_information']['iLO'] }},SystemROM= {{ item['hw_health']['firmware_information']['System ROM'] }}"
        insertafter: EOF
      delegate_to: localhost
      with_items: "{{ ILOinfo.results }}"

This works well enough.

Upvotes: 0

β.εηοιτ.βε
β.εηοιτ.βε

Reputation: 39099

I guess what you mean here is that you are getting a super cluttered debug statement because the item is actually displayed along when the loop happens.

To unclutter this, you can use the label of loop_control.

Something like:

- debug: 
    msg: >-
      {{ 
        item.hw_system_serial 
      }},{{ 
        item.hw_health.firmware_information.iLO 
      }},{{ 
        item.hw_health.firmware_information['System ROM'] 
      }}
  with_items: "{{ ILOinfo.results }}"
  loop_control:
    label: "{{ item.hw_system_serial }}"

Will display a lighter result looking like:

 ok: [localhost] => (item=USE123AHPA) =>
  msg: USE123AHPA,2.75 Aug 13 2020,P89 v2.76 (10/21/2019)

Upvotes: 2

Related Questions