Giter Club home page Giter Club logo

redfish-ansible-module's Introduction

Ansible playbooks and roles for iDRACs using Redfish APIs

This repository contains the Ansible playbook samples and Ansible roles for automating the PowerEdge server lifecycle management using iDRACs and OpenManage Enterprise. The examples highlight the capabilities of the modules and their ability to be integrated into more complex playbooks, workflows, and applications.

These playbooks should give you a very good idea of how to create your own playbooks for your own needs.

Here is a sample inventory file.

Example playbooks and roles use the following collection and modules:

Requirements

Ansible

  • These example playbooks and roles have been developed and tested with maintained version of Ansible core (>= 2.11)
  • When using ansible-core, you will also need to install the following collections:
    ---
    collections:
      - name: community.general
        version: 3.7.0
      - name: dellemc.openmanage
        version: 4.1.0
    Note: You can alternatively install the Ansible community distribution (pip install ansible) if you don't want to manage individual collections.
  • Instructions on how to install Ansible can be found in the Ansible website

Jinja2

  • This role uses Jinja2 templates. Ansible core installs Jinja2 by default, but depending on your install and/or upgrade path, you might be running an outdated version of Jinja2. The minimum version of Jinja2 required for the role to properly function is 2.11.
  • Instructions on how to install Jinja2 can be found in the Jinja2 website.

Installation

Git

Use git clone https://github.com/dell/redfish-ansible-module.git to pull the latest commit of the playbooks and role from GitHub

Documentation

Each Ansible role contains a README with instructions on prerequisites, installation, and usage. Be sure to also review supported resource versions and follow installation instructions for the underlying modules used in the examples per their documentation.

Support

The examples are provided as is with no warranties. Some basic knowledge of the Red Hat Ansible Automation Platform and additional technology integration is expected.

If you run into any problems or would like to provide feedback, please open an issue here

redfish-ansible-module's People

Contributors

alansill avatar anupamaloke avatar bhavesh-bharadiya avatar dependabot[bot] avatar jeis2497052 avatar lyandrew avatar mosibi avatar prabhakarpujeri avatar shubhrata-priya avatar tomasg2012 avatar wrouesnel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

redfish-ansible-module's Issues

Get Manager Attributes support on 12th and 13th Gen servers

Hello,
I am running into the following issue, please advise if this Playbook is available on 12th and 13th Gen servers.

Note that I have included the debug output for the baseuri.

Thanks!

[root@centos7 manager]# ansible-playbook get_manager_attributes.yml                             

PLAY [Get Manager attributes] ***********************************************************************************************************************************************************************************************************

TASK [Set output file] ******************************************************************************************************************************************************************************************************************
included: /root/idrac-ansible-module/playbooks/manager/create_output_file.yml for idrac

TASK [Define timestamp] *****************************************************************************************************************************************************************************************************************
ok: [idrac]

TASK [Define file to place results] *****************************************************************************************************************************************************************************************************
ok: [idrac]

TASK [Create dropoff directory for host] ************************************************************************************************************************************************************************************************
ok: [idrac -> localhost]

TASK [debug] ****************************************************************************************************************************************************************************************************************************
ok: [idrac] => {
    "msg": "172.16.24.22"
}

TASK [Get Manager attributes] ***********************************************************************************************************************************************************************************************************
fatal: [idrac -> localhost]: FAILED! => {"changed": false, "msg": "Error code 404"}
...ignoring

TASK [Copy manager attributes to file] **************************************************************************************************************************************************************************************************
changed: [idrac -> localhost]

PLAY RECAP ******************************************************************************************************************************************************************************************************************************
idrac                      : ok=7    changed=1    unreachable=0    failed=0

playbook power.yml doesn't work

hi,

I tried the the power.yml playbook, but it doesn't work .. Ansible says everything is ok but the server doesn't want to start :
`7514756@s51lv1c:~/Ansible/drp-sn/ansible $ ansible-playbook -i pipo -u 7514756 power_dell_mdc.yml -vvv
Using /home/7514756/Ansible/drp-sn/ansible/ansible.cfg as config file

PLAYBOOK: power_dell_mdc.yml ******************************************************************************************************
1 plays in power_dell_mdc.yml

PLAY [PowerEdge iDRAC Manage System Power] ****************************************************************************************
META: ran handlers

TASK [Turn system power on] *******************************************************************************************************
task path: /home/7514756/Ansible/drp-sn/ansible/power_dell_mdc.yml:23
Using module file /home/7514756/Ansible/drp-sn/ansible/module/idrac-ansible-module-master/library/idrac.py
ESTABLISH LOCAL CONNECTION FOR USER: 7514756
EXEC /bin/sh -c 'echo ~ && sleep 0'
EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /home/7514756/.ansible/tmp/ansible-tmp-1506934891.87-50325564528704" && echo ansible-tmp-1506934891.87-50325564528704="echo /home/7514756/.ansible/tmp/ansible-tmp-1506934891.87-50325564528704" ) && sleep 0'
PUT /tmp/tmpiGwr8d TO /home/7514756/.ansible/tmp/ansible-tmp-1506934891.87-50325564528704/idrac.py
EXEC /bin/sh -c 'chmod u+x /home/7514756/.ansible/tmp/ansible-tmp-1506934891.87-50325564528704/ /home/7514756/.ansible/tmp/ansible-tmp-1506934891.87-50325564528704/idrac.py && sleep 0'
EXEC /bin/sh -c '/usr/bin/python2 /home/7514756/.ansible/tmp/ansible-tmp-1506934891.87-50325564528704/idrac.py; rm -rf "/home/7514756/.ansible/tmp/ansible-tmp-1506934891.87-50325564528704/" > /dev/null 2>&1 && sleep 0'
ok: [s51l007.cmctst.be -> localhost] => {
"changed": false,
"invocation": {
"module_args": {
"category": "SystemPower",
"command": "PowerOn",
"hostname": null,
"idracip": "1.2.3.4",
"idracpswd": "xxxx",
"idracuser": "root",
"sharehost": null,
"sharename": null,
"sharepswd": null,
"shareuser": null,
"userid": "16",
"username": null,
"userpswd": null,
"userrole": null
}
},
"result": 405
}
META: ran handlers
META: ran handlers

PLAY RECAP ************************************************************************************************************************
s51l007.cmctst.be : ok=1 changed=0 unreachable=0 failed=0
`
the only strange thing I see is that the userid is 16 and in my webconsole root has userid 2....

kind regards,

Jonay

Implement a way to efficiently poll LC status during configuration tasks

Ideally, LC status should be checked periodically by polling LC status while any configuration change happens. My team implemented some primitive ways to import SCP and poll, but I think polling needs some additional work. Any task that takes a while should have a way to check the status, etc.

Process for collecting inventory can be streamlined (takes too long)

Currently the process for collecting system inventory takes too long as we make a Redfish call for each inventory element we specify. So per server, we make 12-15 calls. We should make only one Redfish call, however doing do we will have to parse the returned information differently. Best approach?

jq examples probably need to be updated

I am entering this as an issue rather than as a pull request because this might depend on details of the setup I am using.

If I enter the jq example as given in the current README for the results of the CPU inventory playbook, or presumably any playbook that returns an extra layer (in this case "entries") in its json output,

jq '.result | {Manufacturer: .Manufacturer, Name: .Model}' (json file from playbook output)

I get null results.

{
  "Manufacturer": null,
  "Name": null
}

This is apparently due to an extra "entries" layer in the json output, which looks like this raw:

{
  "changed": false,
  "failed": false,
  "result": {
    "entries": [
      {
        "Health": "OK",
        "Manufacturer": "Intel",
        "MaxSpeedMHz": 4000,
        "Model": "Intel(R) Xeon(R) CPU E5-2695 v4 @ 2.10GHz",
        "Name": "CPU.Socket.1",
        "State": "Enabled",
        "TotalCores": 18,
        "TotalThreads": 36
      },
      {
        "Health": "OK",
        "Manufacturer": "Intel",
        "MaxSpeedMHz": 4000,
        "Model": "Intel(R) Xeon(R) CPU E5-2695 v4 @ 2.10GHz",
        "Name": "CPU.Socket.2",
        "State": "Enabled",
        "TotalCores": 18,
        "TotalThreads": 36
      }
    ]
  }
}

If I instead change the jq parsing string to accommodate the extra "entries" layer, it works, e.g.:

jq '(.result | .entries[]) | {Manufacturer: .Manufacturer, Name: .Model}' (json file from playbook output)

produces:

{
  "Manufacturer": "Intel",
  "Name": "Intel(R) Xeon(R) CPU E5-2695 v4 @ 2.10GHz"
}
{
  "Manufacturer": "Intel",
  "Name": "Intel(R) Xeon(R) CPU E5-2695 v4 @ 2.10GHz"
}

Wrong MAC addresses returned for NICs

When you use the redfish plug-in to get NIC information you only get the network Cards Physical MAC address, not the Virtual MAC address, ie. the one it is using right now. By using the following patch you can get both.
-Edit:
Seems like some systems (at least some Poweredge M630) presents the virtual MAC address with different spelling. So the following patch seems to work better:

diff --git a/utils/redfish_utils.py b/utils/redfish_utils.py
index 67f5490..a39eeb9 100644
--- a/utils/redfish_utils.py
+++ b/utils/redfish_utils.py
@@ -843,7 +843,11 @@ class RedfishUtils(object):
                 nic['IPv6'] = d[u'Address']
             for d in data[u'NameServers']:
                 nic['NameServers'] = d
-            nic['MACAddress'] = data[u'PermanentMACAddress']
+            nic['PermanentMACAddress'] = data[u'PermanentMACAddress']
+            try:
+                nic['MACAddress'] = data[u'MacAddress']
+            except:
+                nic['MACAddress'] = data[u'MACAddress']
             nic['SpeedMbps'] = data[u'SpeedMbps']
             nic['MTU'] = data[u'MTUSize']
             nic['AutoNeg'] = data[u'AutoNeg']

Playbooks do not work in latest version of ansible (2.6.1 in this case)

When running any of the playbooks using the currently most recent version available of ansible, I get errors like

ansible-playbook get_cpu_inventory.yml
ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.

The error appears to have been in '/root/dell/redfish-ansible/fordell/redfish-ansible-module/playbooks/get_cpu_inventory.yml': line 15, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  • name: Get CPU Inventory
    ^ here

I have updated to the latest versions of python, including setuptoools and pip, and of ansible available:

ansible-playbook --version
ansible-playbook 2.6.1
config file = None
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /opt/rh/rh-python35/root/usr/lib/python3.5/site-packages/ansible
executable location = /opt/rh/rh-python35/root/usr/bin/ansible-playbook
python version = 3.5.1 (default, Oct 21 2016, 21:37:19) [GCC 4.8.5 20150623 (Red Hat 4.8.5-4)]

The resolution appears to be to specify an additional path to include the module_utils area when issuing the ansible-playbook command. In my case, I was using the "Softwre Collections" version of Python to get to the currently required version 3.5 or greater of Python for the current version of Ansible to run, so the path is:

ansible-playbook --module-path=/opt/rh/rh-python35/root/usr/lib/python3.5/site-packages/ansible/module_utils playbooks/get_cpu_inventory.yml

In general, the path to add will probably be the third one listed when the "python install.py" command runs.

Write scripts to parse through JSON data

Extract data for easy import into a CSV file.

For example, a script could be called extract_system_inventory_and_put_in_cvs_format.py. When running this script, it would go and look at all the xyz_YYYYMMDD_hhmmss_inventory.json files, extract JSON data (using the jq or some other parser) and put all data in one master file, one row per server, with each entry separated by commas:

"PowerEdge R640",  "Physical", "Intel(R) Xeon(R) Silver 4108 CPU @ 1.80GHz","Dell Inc.","1.0.7"..

The file should add a first row with column headers, so line above would become

"Model", "SystemType", "CpuModel", "Manufacturer", "BiosVersion",..
"PowerEdge R640",  "Physical", "Intel(R) Xeon(R) Silver 4108 CPU @ 1.80GHz","Dell Inc.","1.0.7",..

Cannot run playbook - get() takes exactly 1 argument (4 given)

I attempted to run the inventory playbook but it errors out. I can run the get-system-inventory.py script but cannot run this playbook.

It errors out with: get() takes exactly 1 argument (4 given)

Has anyone encountered this before ?

sudo ansible-playbook get_system_inventory.yml

LAY [System Inventory] **************************************************************************************************************************************************************************************************************

TASK [Define output file] ************************************************************************************************************************************************************************************************************
included: /home/ec2-user/redfish-ansible-module/playbooks/create_output_file.yml for testhost

TASK [Define timestamp] **************************************************************************************************************************************************************************************************************
ok: [testhost]

TASK [Define file to place results] **************************************************************************************************************************************************************************************************
ok: [testhost]

TASK [Create dropoff directory for host] *********************************************************************************************************************************************************************************************
ok: [testhost -> localhost]

TASK [Getting system inventory] ******************************************************************************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: get() takes exactly 1 argument (4 given)
fatal: [testhost -> localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File "/tmp/ansible_3aI8Tz/ansible_module_redfish.py", line 367, in \n main()\n File "/tmp/ansible_3aI8Tz/ansible_module_redfish.py", line 224, in main\n result = rf_utils._find_systems_resource(rf_uri)\n File "/tmp/ansible_3aI8Tz/ansible_modlib.zip/ansible/module_utils/redfish_utils.py", line 104, in _find_systems_resource\n File "/tmp/ansible_3aI8Tz/ansible_modlib.zip/ansible/module_utils/redfish_utils.py", line 48, in send_get_request\nTypeError: get() takes exactly 1 argument (4 given)\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 0}
to retry, use: --limit @/home/ec2-user/redfish-ansible-module/playbooks/get_system_inventory.retry

PLAY RECAP ***************************************************************************************************************************************************************************************************************************
testhost : ok=4 changed=0 unreachable=0 failed=1

Add fan information

Add information for system fans, including name, RPMs and overall health.

"msg": "Could not find device driver for iDRAC with IP Address"

when trying to use the ansible tower to perform the execution of a test playbook the following message appears:

"msg": "Could not find device driver for iDRAC with IP address: xxx.xxx.xxx.xxx"

the playbook is very simple following the examples of github:


  • hosts: all
      connection: local
      name: Get HW and SW Inventory for Dell EMC PowerEdge Servers
      gather_facts: False

  tasks:
  - name: Get hardware inventory
    dellemc_idrac_inventory:
      idrac_ip: "{{idrac_ip}}"
      idrac_user: "{{idrac_user}}"
      idrac_pwd: "{{idrac_pwd}}"
    delegate_to: localhost
    tags:
      - hwinventory

  - name: Get firmware inventory
    dellemc_idrac_sw_inventory:
      idrac_ip: "{{idrac_ip}}"
      idrac_user: "{{idrac_user}}"
      idrac_pwd: "{{idrac_pwd}}"
      serialize: True
    delegate_to: localhost
    tags:
      - swinventory

drivers and modules have been installed according to

version of ansible: 3.2.1
SO: rhel 7.4
idrac: idrac 8 v 2.41

How to define variables inside curly {} brackets

Se we can use in manage_idrac_settings.yml when setting iDRAC attributes. Examples:

idrac_attributes={ 'Time.1.Timezone' : 'US/Central' }
idrac_attributes={ 'NTPConfigGroup.1.NTP1' : 'ntp.server.com' }

Would be great to instead use:

idrac_attributes={ 'Time.1.Timezone' : timezone }
idrac_attributes={ 'NTPConfigGroup.1.NTP1' : ntpserver }

LDAP/Active Directory

Any plans to support binding to/configuring LDAP/AD settings? This is the single most painful part about running iDRACs.

OnetimeBoot problem

Since the last release i can no longer use the onetimeboot with Pxe. When i check the setting after putting any value as the boot value it is always set to UefiTarget. I have rolled back to the older release and it works fine.

Enable or disable PXE

Add ability to enable or disable PXE on network interfaces. Can be implemented by updating BIOS parameters, specifically PxeDev1EnDi, PxeDev2EnDis, etc.

Issue when deciding if FW version is latest installed

Depending on a device firmware version, the compare_firmware() function may not always detect correctly that the current installed FW version is the latest version.

For example my 14G server has PERC FW 50.0.1-0639 installed, but in compare_firmware() it thinks it's only 50.0.1, so when it compares to the latest FW available (50.0.1-0639) it tries to install again.

Issue could be related to the extra versioning with the dash ("-").

Attempt to install FW only if image was uploaded

In the firmware_upgrade playbook, run the last task (install firmware image) only if the FW image was uploaded in the previous task. Can we use the fw_available variable?

Maybe add?

when fw_available.changed

SSL Protocol error

After moving from requests library to ansible.module_utils.urls.open_url, I see some sporadic errors:

URL Error: EOF occurred in violation of protocol (_ssl.c:579)

Errors are intermittent, and possibly caused by TLS certificates in OOB controller. (?)

Handle failure codes as failures

It looks like a lot of failure codes aren't picked up as module failures, and thus treat the host as "ok" despite nothing working - i.e. this 401 error shows as green:
ok: [fresh.nodes -> provisioning] => {"changed": false, "failed": false, "result": 401}

PXE Setting for Network Interface are not exposed in Bios settings for all tested servers

PxeDev1EnDis is not exposed in Bios Setting for Gen12, 13 and 14 Platforms.
When attempting the enable PXE mode for an Integrated NIC the following errors appears:

ansible-playbook 2.4.3.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609]
Using /etc/ansible/ansible.cfg as config file
Parsed localhost, inventory source with host_list plugin

PLAYBOOK: enable_pxe.yml *************************************************************************************************************************************************************
1 plays in enable_pxe.yml

PLAY [Enable PXE in NICs] ************************************************************************************************************************************************************
META: ran handlers

TASK [Enable PXE Boot for NIC1] ******************************************************************************************************************************************************
task path: /root/idrac-ansible-module/enable_pxe.yml:12
Using module file /root/idrac-ansible-module/library/redfish.py
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c 'echo ~ && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1520841276.2-87132249353562 `" && echo ansible-tmp-1520841276.2-87132249353562="` echo /root/.ansible/tmp/ansible-tmp-1520841276.2-87132249353562 `" ) && sleep 0'
<localhost> PUT /tmp/tmpa1ql9Q TO /root/.ansible/tmp/ansible-tmp-1520841276.2-87132249353562/redfish.py
<localhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1520841276.2-87132249353562/ /root/.ansible/tmp/ansible-tmp-1520841276.2-87132249353562/redfish.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1520841276.2-87132249353562/redfish.py; rm -rf "/root/.ansible/tmp/ansible-tmp-1520841276.2-87132249353562/" > /dev/null 2>&1 && sleep 0'
fatal: [localhost -> localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "baseuri": "xxx.xxx.xxx.xxx",
            "bios_attr_name": "PxeDev1EnDis",
            "bios_attr_value": "Enabled",
            "bootdevice": null,
            "category": "System",
            "command": "SetBiosAttributes",
            "mgr_attr_name": null,
            "mgr_attr_value": null,
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "user": "root",
            "userid": null,
            "username": null,
            "userpswd": null,
            "userrole": null
        }
    },
    "msg": "Not supported on this platform"
}
...ignoring
META: ran handlers
META: ran handlers

PLAY RECAP ***************************************************************************************************************************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=0

This was tested on Dell R720, R730 and R740 with a different set of Daughter Cards ( Intel, Qlogic and Broadcom ). My Broadcom chipset is different then the one that was used in your sample server. In all cases Attributes dict in https://host/redfish/v1/Systems/System.Embedded.1/Bios/ endpoint doesn't have the PxeDev1EnDis Attribute. Attempting to apply the values manually with curl at https://host/redfish/v1/Systems/System.Embedded.1/Bios/Settings/ results in error :)

Example output from Dell R740:

"Attributes": {
...
"OppSrefEn": "Disabled",
"OsWatchdogTimer": "Disabled",
"PasswordStatus": "Unlocked",
"PcieAspmL1": "Enabled",
"PowerCycleRequest": "None",
"Proc1Brand": "Intel(R) Xeon(R) Gold 5120 CPU @ 2.20GHz",
"Proc1Id": "6-55-4",
"Proc1L2Cache": "14x1 MB",
"Proc1L3Cache": "19712 KB",
"Proc1NumCores": 14,
"Proc1TurboCoreNum": "All",
"Proc2Brand": "Intel(R) Xeon(R) Gold 5120 CPU @ 2.20GHz",
"Proc2Id": "6-55-4",
"Proc2L2Cache": "14x1 MB",
"Proc2L3Cache": "19712 KB",
"Proc2NumCores": 14,
"Proc2TurboCoreNum": "All",
"ProcAdjCacheLine": "Enabled",
"ProcBusSpeed": "10.40 GT/s",
"ProcC1E": "Enabled",
"ProcCStates": "Enabled",
"ProcCoreSpeed": "2.20 GHz",
"ProcCores": "All",
"ProcHwPrefetcher": "Enabled",
"ProcPwrPerf": "SysDbpm",
"ProcTurboMode": "Enabled",
"ProcVirtualization": "Enabled",
"ProcX2Apic": "Disabled",
"PwrButton": "Enabled",
"RedirAfterBoot": "Enabled",
"RedundantOsLocation": "None",
"SataPortA": "Auto",
"SataPortACapacity": "N/A",
...

Tested on the following hardware:

  1. R740 with BRCM 2P 25G SFP rNDC
  2. R740 with QLogic 1G+10GE QL41264HMCU CNA
  3. R730 with Intel(R) 2P X520/2P I350 rNDC
  4. R720 with Intel(R) 2P X540/2P I350 rNDC

@jose-delarosa , any chance you tested this functionality on any other combination of hardware and Daughter Cards ?

Ability to upgrade firmware on 13th gen/iDRAC 8

Hi,

I see the redfish API and your scripts will make my work easier but it seems that redfish are not fully supported by my hardware, only a limited set of API endpoint are visible on my iDRAC.

It seems on 13th gen R630 host (with iDRAC 8, firmware 2.50.50.50), the /redfish/v1/UpdateService/FirmwareInventory/ is not available.

Can you confirm, as indicated on your documentation, that firmware upgrade via redfish API is available on 13th gen/iDRAC 8 ?

btw redfish and your ansible playbook is a great work, keep going ;)

Support setting one-time boot.

As in the comment - there's no way with this module to set the one-time boot order that I can see, as only "GetAttributes" and "GetBootOrder" are supported under the "Bios" command category.

The value string or enum for the property NIC.1.VLanID is of a different type than the property can accept

Running this code

- name: Set VLAN tag 1
  local_action: >
     redfish category=Manager command=SetAttributes
     user={{user}} password={{password}} baseuri={{baseuri}}
     mgr_attr_name=NIC.1.VLanID mgr_attr_value=1
  register: set_vlan_tag

Results in this error:

fatal: [r640 -> localhost]: FAILED! => {"changed": false, "msg": "Error code {
	u 'error': {
		u 'code': u 'Base.1.0.GeneralError',
		u 'message': u 'A general error has occurred. See ExtendedInfo for more information',
		u '@Message.ExtendedInfo': [{
			u 'Severity': u 'Warning',
			u 'RelatedProperties': [u 'NIC.1.VLanID'],
			u 'MessageId': u 'Base.1.0.PropertyValueTypeError',
			u '[email protected]': 2,
			u '[email protected]': 1,
			u 'Message': u 'The value string or enum for the property NIC.1.VLanID is of a different type than the property can accept.',
			u 'Resolution': u 'Correct the value for the property in the request body and resubmit the request if the operation failed.',
			u 'MessageArgs': [u 'string or enum', u 'NIC.1.VLanID']
		}]
	}
}

I suspect the redfisch schema expects a integer instead of a string

Skip execution if the same configuration is already set

Hi,
I would like to ask you to implement option check before executing change command. For example:

  1. run playbook with some bios config sets
  2. wait until reboot is done
  3. run same playbook from 1) with same settings

Server gets rebooted again.
It would be great to check system settings value before forcefully apply same setting and again reboot server.

I am using this to have requested functionality, but I think it should be build-in in redfish_config module.

- name: Set Secure boot state
  redfish_config:
    category: Systems
    command: SetBiosAttributes
    bios_attr_name: SecureBoot
    bios_attr_value: "{{ idrac_secure_boot_state }}"
    baseuri: "{{ baseuri }}"
    user: "{{ user }}"
    password: "{{ password }}"
  when: ansible_facts.redfish_facts.bios_attribute.entries.SecureBoot != idrac_secure_boot_state
  notify:
    - Add to BIOS queue

How to apply BIOS changes without BIOS reboot option

Hello,

I am trying to get set BIOS settings through this module, but as long as I remove the 'reboot' line from the playbooks I am not able to get the settings applied. In general I wish to run the playbook to adjust certain settings and have them queue'd for the next reboot. Once I do this and manually logon the server and 'reboot' it, the settings are never being applied. But if I enabled the part:

#  - name: Schedule Config Job - Reboot
#    redfish:
#      category: System
#      command: CreateBiosConfigJob
#      baseuri: "{{ baseuri }}"
#      user: "{{ user }}"
#      password: "{{ password }}"

The server reboots with (Lifecycle Controller: System Configuration Requested) after this job has completed (which I prefer not to happen unless I want to reboot it). How can I schedule the BIOS update but without rebooting it from the playbook? But have it apply the next time I manually reboot the server (from the OS side).

More elegant way to create iDRAC users

When creating users, rather than specify a specific user ID (1-16) in a playbook, query for empty users slots and use the first one available. The default user (root) is always ID #2, so it should never be #2.

failed to get firmwares inventory

Hello, running get_firmware_inventory.yml against a 13g (r630) server with latest firmware (2.50.50.50), it failed.
Others playbooks like get_system_inventory.yml worked fine. So, did I missed something? Do I have to enable some config in iDRAC?

fatal: [myserver.example.net -> localhost]: FAILED! => {
    "changed": false, 
    "invocation": {
        "module_args": {
            "FWPath": null, 
            "InstallOption": null, 
            "Model": null, 
            "baseuri": "myserver.rmcp.example.net", 
            "bios_attr_name": null, 
            "bios_attr_value": null, 
            "bootdevice": null, 
            "category": "Update", 
            "command": "GetFirmwareInventory", 
            "hostname": null, 
            "mgr_attr_name": null, 
            "mgr_attr_value": null, 
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
            "scpfile": null, 
            "sharehost": null, 
            "sharename": null, 
            "sharepswd": null, 
            "shareuser": null, 
            "user": "root", 
            "userid": null, 
            "username": null, 
            "userpswd": null, 
            "userrole": null
        }
    }, 
    "msg": "UpdateService does not exist"
}
...ignoring

issue with running playbook

Hi,
I have an issue with running playbook ... any playbook. I follow the readme file but it seems something is missing.
once running : "ansible-playbook get_firmware_inventory.yml" I get a fatal error - can you please tell what it means see below:
$ ansible-playbook get_firmware_inventory.yml
[DEPRECATION WARNING]: The use of 'include' for tasks has been deprecated. Use 'import_tasks' for static inclusions or 'include_tasks' for dynamic inclusions. This
feature will be removed in a future release. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
[DEPRECATION WARNING]: include is kept for backwards compatibility but usage is discouraged. The module documentation details page may explain more about this rationale..
This feature will be removed in a future release. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.

PLAY [PowerEdge iDRAC Device Firmware Inventory] **************************************************************************************************************************

TASK [Define timestamp] ***************************************************************************************************************************************************
ok: [localadmin]

TASK [Define file to place results] ***************************************************************************************************************************************
ok: [localadmin]

TASK [Create dropoff directory for host] **********************************************************************************************************************************
ok: [localadmin -> localhost]

TASK [Get Firmware Inventory] *********************************************************************************************************************************************
fatal: [localadmin]: FAILED! => {"msg": "The module idrac was not found in configured module paths. Additionally, core modules are missing. If this is a checkout, run 'git pull --rebase' to correct this problem."}
...ignoring

TASK [Copy inventory to file] *********************************************************************************************************************************************
changed: [localadmin -> localhost]

PLAY RECAP ****************************************************************************************************************************************************************
localadmin : ok=5 changed=1 unreachable=0 failed=0

Example BootMode to Legacy BIOS on iDRAC 8 version 2.52.52.52

Help Wanted!

---
- hosts: localhost
  connection: local
  name: Set boot mode to Legacy BIOS and reboot
  gather_facts: False

  tasks:
  - name: Set BootMode to Legacy BIOS
    redfish:
      category: System
      command: SetBiosAttributes
      bios_attr_name: BootMode
      bios_attr_value: Bios
      baseuri: 10.1.3.45"
      user: "root"
      password: "password"

This was taken from the redfish example. But upon runing it gives following error.

ansible-playbook setBiosBootMode.yml

PLAY [Set boot mode to Legacy BIOS and reboot] ************************************************************************************************************************************************

TASK [Set BootMode to Legacy BIOS] ************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "URL Error: [Errno -2] Name or service not known"}
 [WARNING]: Could not create retry file '/etc/ansible/idrac7-20.yml/setBiosBootMode.retry'.         [Errno 13] Permission denied: u'/etc/ansible/idrac7-20.yml/setBiosBootMode.retry'

Clean up output when using storage.yml

Current output is hard to read:

Status: {"PERC H310 Adapter": "OK"}
listDevices: {"PERC H310 Adapter": [{"Status": {"HealthRollUp": "OK", "State": "Enabled", "Health": "OK"}, "Model": "ST9146853SS", "Name": "Physical Disk 0:1:0", "Manufacturer": "SEAGATE"}, {"Status": {"HealthRollUp": "OK", "State": "Enabled", "Health": "OK"}, "Model": "ST9146853SS", "Name": "Physical Disk 0:1:1", "Manufacturer": "SEAGATE"}, {"Status": {"HealthRollUp": "OK", "State": "Enabled", "Health": "OK"}, "Model": "ST9146853SS", "Name": "Physical Disk 0:1:2", "Manufacturer": "SEAGATE"}, {"Status": {"HealthRollUp": "OK", "State": "Enabled", "Health": "OK"}, "Model": "ST9146853SS", "Name": "Physical Disk 0:1:3", "Manufacturer": "SEAGATE"}, {"Status": {"HealthRollUp": "OK", "State": "Enabled", "Health": "OK"}, "Model": "BP12G+EXP 0:1", "Name": "Backplane 1 on Connector 0 of RAID Controller in Slot 4", "Manufacturer": "DELL"}]}

Clean up so if comes out cleaner, for example:

Controller: PERC H310 Adapter
Status: OK

HealthRollUp : OK
State : Enabled
Health : OK
Model : ST9146853SS
Name : Physical Disk 0:1:0
Manufacturer : SEAGATE

HealthRollUp : OK
State : Enabled
Health : OK
Model : ST9146853SS
Name : Physical Disk 0:1:1
Manufacturer : SEAGATE

HealthRollUp : OK
State : Enabled
Health : OK
Model : BP12G+ 0:1
Name : Backplane 1 on Connector 0 of Integrated RAID Controller 1
Manufacturer : DELL

Query for pending BIOS updates

Is there a Redfish API to query for pending BIOS settings updates? BIOS settings updates could have been done through Redfish or by any other method.

Module failures during playbook runs

When trying to run the get_system_inventory playbook, I'm getting the following -

"module_stderr": "Traceback (most recent call last):\n File "/tmp/ansible_agtZY8/ansible_module_redfish.py", line 367, in \n main()\n File "/tmp/ansible_agtZY8/ansible_module_redfish.py", line 224, in main\n result = rf_utils._find_systems_resource(rf_uri)\n File "/tmp/ansible_agtZY8/ansible_modlib.zip/ansible/module_utils/redfish_utils.py", line 104, in _find_systems_resource\n File "/tmp/ansible_agtZY8/ansible_modlib.zip/ansible/module_utils/redfish_utils.py", line 48, in send_get_request\nTypeError: get() takes exactly 1 argument (4 given)\n", "module_stdout": "", "msg": "MODULE FAILURE"

My package versions are -

ansible-2.4.2.0-2.el7.noarch
python-requests-2.6.0-1.el7_1.noarch
python-urllib3-1.10.2-5.el7.noarch

Firmware update fails with status code 413 .. error code : 400

It failed when i ran the upgrade_firmware.yml , is there some configuration that i'm supposed to do?

failed: [testhost -> localhost] (item={u'path': u'FOLDER04936438M/1/Drivers-for-OS-Deployment_Application_RHM02_WN64_18.04.07_A00.EXE', u'curr': u'17.08.12', u'latest': u'18.04.07'}) => {"changed": false, "item": {"curr": "17.08.12", "latest": "18.04.07", "path": "FOLDER04936438M/1/Drivers-for-OS-Deployment_Application_RHM02_WN64_18.04.07_A00.EXE"}, "msg": "Error uploading firmware; status_code=413"}

.
.
.
.
TASK [install firmware image] *******************************************************************************************************************************************************************************************************************
fatal: [testhost -> localhost]: FAILED! => {"changed": false, "msg": "Error code 400"}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.