BR:
does anyone did some Lab on Dell iDRAC? If so, how did you get a specific info like I only want to get the service tag of the server and nothing else. service tag is the serial number … thanks …
Al West:
Dell publish an ansible module on GitHub:
https://github.com/dell/dellemc-openmanage-ansible-modules
BR:
got that thanks… but I don’t see the system info specific to what I am looking for. If you can give an example plays e.g. specific to serial number
Andrei Andriushin:
Hi! Look at this usage example: https://dell.github.io/dellemc-openmanage-ansible-modules/GUID-39F65738-53B5-436A-8411-77F321752954.html
Combined with register
keyword it can be var_name.system_info.sample.BIOS.VersionString
To find service tag use ansible with -vvv
option or ansible.builtin.debug
task
BR:
Thank you! I know I am doing it wrongly … can you please see what missing here?
BR:
-
hosts: target01
connection: local
gather_facts: Falsetasks:
- name: Get hardware inventory
dellemc.openmanage.idrac_system_info:
idrac_ip: “{{ idrac_ip }}”
idrac_user: “{{ idrac_user }}”
idrac_password: “{{ idrac_password }}”
validate_certs: false
register: BIOS.VersionString
- name: Get hardware inventory
BR:
so from the verbose
BR:
system_info:
BIOS:
- BIOSReleaseDate: 07/07/2021
FQDD: BIOS.Setup.1-1
InstanceID: DCIM:INSTALLED#741__BIOS.Setup.1-1
Key: DCIM:INSTALLED#741__BIOS.Setup.1-1
SMBIOSPresent: ‘True’
VersionString: 2.6.3
BR:
say I want to get now the VersionString
BR:
from my play I am getting Invalid variable name in ‘‘register’’ specified: ‘‘BIOS.VersionString’’’
Al West:
Setup:
pip3 install ansible ansible-lint
ansible-galaxy collection install git+<https://github.com/dell/dellemc-openmanage-ansible-modules.git,collections>
pip3 install omsdk --upgrade
Playbook:
---
- hosts: localhost
tasks:
- name: Get System Inventory
dellemc.openmanage.idrac_system_info:
idrac_ip: "192.168.0.1"
idrac_user: "admin"
idrac_password: "admin"
validate_certs: false
register: system_info
- name: Debug output
debug:
msg: "{{ system_info.system_info.System[0].ServiceTag }}"
ansible-playbook idrac.yaml
BR:
Thank you guys! It’s working now and I will do the rest! however, why do you need to include System[0] there? newbie here …
Al West:
System is an array
BR:
you awesome guys! Ok got it, was not paying attention to the array lol! Very happy now! Thank you again @Al West @Andrei Andriushin I can now make a report with a csv.
- name: Debug output
debug:
msg: "{{ system_info_bios_version_string.system_info.BIOS[0].VersionString }}"
BR:
is it possible to just get the output without a debug and msg? I just want to create a reference for that output?
BR:
What I am trying to say is something like this
- name: Get BDDS Serial
ansible.builtin.shell: dmidecode -t system | grep -i serial -A0 | awk '{print $3}'
register: br_bdds_serial
BR:
i don’t want to have the debug and msg but the output will put directly into register. is that possible?
Al West:
It is already in the register. What you are seeing is the extra output of debug. You can check by touching a file and seeing it will only be the ServiceTag:
- name: Touch a file
ansible.builtin.file:
path: "{{ system_info.system_info.System[0].ServiceTag }}"
state: touch
BR:
ok I did that, and it created a file exactly the serial number
BR:
snippet
tasks:
- name: Get Service Tag
dellemc.openmanage.idrac_system_info:
idrac_ip: "{{ idrac_ip }}"
idrac_user: "{{ idrac_user }}"
idrac_password: "{{ idrac_password }}"
validate_certs: false
register: svctag
- name: Touch a file
ansible.builtin.file:
path: "{{ svctag.system_info.System[0].ServiceTag }}"
state: touch
register: st
- name: Save CSV headers
ansible.builtin.lineinfile:
dest: "{{ csv_path }}/{{ csv_filename }}"
line: "{{ headers }}"
create: true
state: present
delegate_to: localhost
run_once: true
- name: Build out CSV file
ansible.builtin.lineinfile:
dest: "{{ csv_path }}/{{ csv_filename}}"
line: "{{ st }}"
create: true
state: present
delegate_to: localhost