I am probably missing something simple, but here goes.
I am new to ansible and am using the DellEMC openmanage module to gather IDRAC information. The first step is to be able to gather the info. I am having a problem parsing the output. Play book below.
'''
[root@<hostname> scripts]# cat test2.yml
---
- hosts: localhost
gather_facts: False
connection: local
collections:
- dellemc.openmanage
tasks:
- name: include file
include_vars: idrac.yml
- name: Get Hardware Inventory
dellemc.openmanage.idrac_system_info:
idrac_ip: "{{ item }}"
idrac_user: "{{idrac_user}}"
idrac_pwd: "{{idrac_pwd}}"
loop: "{{ idrac_ip }}"
register: gather_system_info
- name: Parse
debug:
var: "{{ item['system_info']['System'][0]['ChassisServiceTag'] }}"
with_items: "{{ gather_system_info['results'] }}"
I will shorten output cause it is like thousands of lines but this is the original output I am trying to parse from. Error received was "fatal: [localhost]: FAILED! => {"msg": "template error while templating string: expected token 'end of print statement', got '<service_tag'. String: {{<Service_tag>}}"}
ok: [localhost] => {
"msg": {
"changed": false,
"msg": "All items completed",
"results": [
{
"ansible_loop_var": "item",
"changed": false,
"failed": false,
"invocation": {
"module_args": {
"idrac_ip": "<looped_ip>",
"idrac_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"idrac_port": 443,
"idrac_pwd": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"idrac_user": "root"
}
},
"item": "<looped_ip>",
"msg": "Successfully fetched the system inventory details.",
"system_info": {
"System": [
{
"AssetTag": "Not Available",
"BIOSReleaseDate": "07/09/2021",
"BIOSVersionString": "2.12.2",
"BaseBoardChassisSlot": "NA",
"BladeGeometry": "255",
"BoardPartNumber": "08HT8TA00",
"BoardSerialNumber": "CNIVC0091B0592",
"CMCIP": "Not Available",
"CPLDVersion": "1.0.2",
"ChassisModel": "Not Available",
"ChassisName": "Main System Chassis",
"ChassisServiceTag": "<service_tag>",