|
|
@ -13,13 +13,15 @@ ANSIBLE_METADATA = {'status': ['preview'],
|
|
|
|
|
|
|
|
|
|
|
|
DOCUMENTATION = '''
|
|
|
|
DOCUMENTATION = '''
|
|
|
|
---
|
|
|
|
---
|
|
|
|
module: redfish_facts
|
|
|
|
module: redfish_info
|
|
|
|
version_added: "2.7"
|
|
|
|
version_added: "2.7"
|
|
|
|
short_description: Manages Out-Of-Band controllers using Redfish APIs
|
|
|
|
short_description: Manages Out-Of-Band controllers using Redfish APIs
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Builds Redfish URIs locally and sends them to remote OOB controllers to
|
|
|
|
- Builds Redfish URIs locally and sends them to remote OOB controllers to
|
|
|
|
get information back.
|
|
|
|
get information back.
|
|
|
|
- Information retrieved is placed in a location specified by the user.
|
|
|
|
- Information retrieved is placed in a location specified by the user.
|
|
|
|
|
|
|
|
- This module was called C(redfish_facts) before Ansible 2.9, returning C(ansible_facts).
|
|
|
|
|
|
|
|
Note that the M(redfish_info) module no longer returns C(ansible_facts)!
|
|
|
|
options:
|
|
|
|
options:
|
|
|
|
category:
|
|
|
|
category:
|
|
|
|
required: false
|
|
|
|
required: false
|
|
|
@ -60,82 +62,90 @@ author: "Jose Delarosa (@jose-delarosa)"
|
|
|
|
|
|
|
|
|
|
|
|
EXAMPLES = '''
|
|
|
|
EXAMPLES = '''
|
|
|
|
- name: Get CPU inventory
|
|
|
|
- name: Get CPU inventory
|
|
|
|
redfish_facts:
|
|
|
|
redfish_info:
|
|
|
|
category: Systems
|
|
|
|
category: Systems
|
|
|
|
command: GetCpuInventory
|
|
|
|
command: GetCpuInventory
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
|
username: "{{ username }}"
|
|
|
|
username: "{{ username }}"
|
|
|
|
password: "{{ password }}"
|
|
|
|
password: "{{ password }}"
|
|
|
|
|
|
|
|
register: result
|
|
|
|
- debug:
|
|
|
|
- debug:
|
|
|
|
msg: "{{ redfish_facts.cpu.entries | to_nice_json }}"
|
|
|
|
msg: "{{ result.redfish_facts.cpu.entries | to_nice_json }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: Get CPU model
|
|
|
|
- name: Get CPU model
|
|
|
|
redfish_facts:
|
|
|
|
redfish_info:
|
|
|
|
category: Systems
|
|
|
|
category: Systems
|
|
|
|
command: GetCpuInventory
|
|
|
|
command: GetCpuInventory
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
|
username: "{{ username }}"
|
|
|
|
username: "{{ username }}"
|
|
|
|
password: "{{ password }}"
|
|
|
|
password: "{{ password }}"
|
|
|
|
|
|
|
|
register: result
|
|
|
|
- debug:
|
|
|
|
- debug:
|
|
|
|
msg: "{{ redfish_facts.cpu.entries.0.Model }}"
|
|
|
|
msg: "{{ result.redfish_facts.cpu.entries.0.Model }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: Get memory inventory
|
|
|
|
- name: Get memory inventory
|
|
|
|
redfish_facts:
|
|
|
|
redfish_info:
|
|
|
|
category: Systems
|
|
|
|
category: Systems
|
|
|
|
command: GetMemoryInventory
|
|
|
|
command: GetMemoryInventory
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
|
username: "{{ username }}"
|
|
|
|
username: "{{ username }}"
|
|
|
|
password: "{{ password }}"
|
|
|
|
password: "{{ password }}"
|
|
|
|
|
|
|
|
register: result
|
|
|
|
|
|
|
|
|
|
|
|
- name: Get fan inventory with a timeout of 20 seconds
|
|
|
|
- name: Get fan inventory with a timeout of 20 seconds
|
|
|
|
redfish_facts:
|
|
|
|
redfish_info:
|
|
|
|
category: Chassis
|
|
|
|
category: Chassis
|
|
|
|
command: GetFanInventory
|
|
|
|
command: GetFanInventory
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
|
username: "{{ username }}"
|
|
|
|
username: "{{ username }}"
|
|
|
|
password: "{{ password }}"
|
|
|
|
password: "{{ password }}"
|
|
|
|
timeout: 20
|
|
|
|
timeout: 20
|
|
|
|
|
|
|
|
register: result
|
|
|
|
|
|
|
|
|
|
|
|
- name: Get Virtual Media information
|
|
|
|
- name: Get Virtual Media information
|
|
|
|
redfish_facts:
|
|
|
|
redfish_info:
|
|
|
|
category: Manager
|
|
|
|
category: Manager
|
|
|
|
command: GetVirtualMedia
|
|
|
|
command: GetVirtualMedia
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
|
username: "{{ username }}"
|
|
|
|
username: "{{ username }}"
|
|
|
|
password: "{{ password }}"
|
|
|
|
password: "{{ password }}"
|
|
|
|
|
|
|
|
register: result
|
|
|
|
- debug:
|
|
|
|
- debug:
|
|
|
|
msg: "{{ redfish_facts.virtual_media.entries | to_nice_json }}"
|
|
|
|
msg: "{{ result.redfish_facts.virtual_media.entries | to_nice_json }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: Get Volume Inventory
|
|
|
|
- name: Get Volume Inventory
|
|
|
|
redfish_facts:
|
|
|
|
redfish_info:
|
|
|
|
category: Systems
|
|
|
|
category: Systems
|
|
|
|
command: GetVolumeInventory
|
|
|
|
command: GetVolumeInventory
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
|
username: "{{ username }}"
|
|
|
|
username: "{{ username }}"
|
|
|
|
password: "{{ password }}"
|
|
|
|
password: "{{ password }}"
|
|
|
|
|
|
|
|
register: result
|
|
|
|
- debug:
|
|
|
|
- debug:
|
|
|
|
msg: "{{ redfish_facts.volume.entries | to_nice_json }}"
|
|
|
|
msg: "{{ result.redfish_facts.volume.entries | to_nice_json }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: Get Session information
|
|
|
|
- name: Get Session information
|
|
|
|
redfish_facts:
|
|
|
|
redfish_info:
|
|
|
|
category: Sessions
|
|
|
|
category: Sessions
|
|
|
|
command: GetSessions
|
|
|
|
command: GetSessions
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
|
username: "{{ username }}"
|
|
|
|
username: "{{ username }}"
|
|
|
|
password: "{{ password }}"
|
|
|
|
password: "{{ password }}"
|
|
|
|
|
|
|
|
register: result
|
|
|
|
- debug:
|
|
|
|
- debug:
|
|
|
|
msg: "{{ redfish_facts.session.entries | to_nice_json }}"
|
|
|
|
msg: "{{ result.redfish_facts.session.entries | to_nice_json }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: Get default inventory information
|
|
|
|
- name: Get default inventory information
|
|
|
|
redfish_facts:
|
|
|
|
redfish_info:
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
|
username: "{{ username }}"
|
|
|
|
username: "{{ username }}"
|
|
|
|
password: "{{ password }}"
|
|
|
|
password: "{{ password }}"
|
|
|
|
|
|
|
|
register: result
|
|
|
|
- debug:
|
|
|
|
- debug:
|
|
|
|
msg: "{{ redfish_facts | to_nice_json }}"
|
|
|
|
msg: "{{ result.redfish_facts | to_nice_json }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: Get several inventories
|
|
|
|
- name: Get several inventories
|
|
|
|
redfish_facts:
|
|
|
|
redfish_info:
|
|
|
|
category: Systems
|
|
|
|
category: Systems
|
|
|
|
command: GetNicInventory,GetBiosAttributes
|
|
|
|
command: GetNicInventory,GetBiosAttributes
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
@ -143,21 +153,21 @@ EXAMPLES = '''
|
|
|
|
password: "{{ password }}"
|
|
|
|
password: "{{ password }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: Get default system inventory and user information
|
|
|
|
- name: Get default system inventory and user information
|
|
|
|
redfish_facts:
|
|
|
|
redfish_info:
|
|
|
|
category: Systems,Accounts
|
|
|
|
category: Systems,Accounts
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
|
username: "{{ username }}"
|
|
|
|
username: "{{ username }}"
|
|
|
|
password: "{{ password }}"
|
|
|
|
password: "{{ password }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: Get default system, user and firmware information
|
|
|
|
- name: Get default system, user and firmware information
|
|
|
|
redfish_facts:
|
|
|
|
redfish_info:
|
|
|
|
category: ["Systems", "Accounts", "Update"]
|
|
|
|
category: ["Systems", "Accounts", "Update"]
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
|
username: "{{ username }}"
|
|
|
|
username: "{{ username }}"
|
|
|
|
password: "{{ password }}"
|
|
|
|
password: "{{ password }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: Get Manager NIC inventory information
|
|
|
|
- name: Get Manager NIC inventory information
|
|
|
|
redfish_facts:
|
|
|
|
redfish_info:
|
|
|
|
category: Manager
|
|
|
|
category: Manager
|
|
|
|
command: GetManagerNicInventory
|
|
|
|
command: GetManagerNicInventory
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
@ -165,7 +175,7 @@ EXAMPLES = '''
|
|
|
|
password: "{{ password }}"
|
|
|
|
password: "{{ password }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: Get boot override information
|
|
|
|
- name: Get boot override information
|
|
|
|
redfish_facts:
|
|
|
|
redfish_info:
|
|
|
|
category: Systems
|
|
|
|
category: Systems
|
|
|
|
command: GetBootOverride
|
|
|
|
command: GetBootOverride
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
@ -173,7 +183,7 @@ EXAMPLES = '''
|
|
|
|
password: "{{ password }}"
|
|
|
|
password: "{{ password }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: Get chassis inventory
|
|
|
|
- name: Get chassis inventory
|
|
|
|
redfish_facts:
|
|
|
|
redfish_info:
|
|
|
|
category: Chassis
|
|
|
|
category: Chassis
|
|
|
|
command: GetChassisInventory
|
|
|
|
command: GetChassisInventory
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
@ -181,7 +191,7 @@ EXAMPLES = '''
|
|
|
|
password: "{{ password }}"
|
|
|
|
password: "{{ password }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: Get all information available in the Manager category
|
|
|
|
- name: Get all information available in the Manager category
|
|
|
|
redfish_facts:
|
|
|
|
redfish_info:
|
|
|
|
category: Manager
|
|
|
|
category: Manager
|
|
|
|
command: all
|
|
|
|
command: all
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
@ -189,7 +199,7 @@ EXAMPLES = '''
|
|
|
|
password: "{{ password }}"
|
|
|
|
password: "{{ password }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: Get firmware update capability information
|
|
|
|
- name: Get firmware update capability information
|
|
|
|
redfish_facts:
|
|
|
|
redfish_info:
|
|
|
|
category: Update
|
|
|
|
category: Update
|
|
|
|
command: GetFirmwareUpdateCapabilities
|
|
|
|
command: GetFirmwareUpdateCapabilities
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
@ -197,7 +207,7 @@ EXAMPLES = '''
|
|
|
|
password: "{{ password }}"
|
|
|
|
password: "{{ password }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: Get all information available in all categories
|
|
|
|
- name: Get all information available in all categories
|
|
|
|
redfish_facts:
|
|
|
|
redfish_info:
|
|
|
|
category: all
|
|
|
|
category: all
|
|
|
|
command: all
|
|
|
|
command: all
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
|
baseuri: "{{ baseuri }}"
|
|
|
@ -252,6 +262,10 @@ def main():
|
|
|
|
),
|
|
|
|
),
|
|
|
|
supports_check_mode=False
|
|
|
|
supports_check_mode=False
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
is_old_facts = module._name == 'redfish_facts'
|
|
|
|
|
|
|
|
if is_old_facts:
|
|
|
|
|
|
|
|
module.deprecate("The 'redfish_facts' module has been renamed to 'redfish_info', "
|
|
|
|
|
|
|
|
"and the renamed one no longer returns ansible_facts", version='2.13')
|
|
|
|
|
|
|
|
|
|
|
|
# admin credentials used for authentication
|
|
|
|
# admin credentials used for authentication
|
|
|
|
creds = {'user': module.params['username'],
|
|
|
|
creds = {'user': module.params['username'],
|
|
|
@ -388,7 +402,10 @@ def main():
|
|
|
|
result["log"] = rf_utils.get_logs()
|
|
|
|
result["log"] = rf_utils.get_logs()
|
|
|
|
|
|
|
|
|
|
|
|
# Return data back
|
|
|
|
# Return data back
|
|
|
|
|
|
|
|
if is_old_facts:
|
|
|
|
module.exit_json(ansible_facts=dict(redfish_facts=result))
|
|
|
|
module.exit_json(ansible_facts=dict(redfish_facts=result))
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
module.exit_json(redfish_facts=result)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
if __name__ == '__main__':
|