Changes to redfish-based parameters (#48717)

* Changes to redfish-based parameters

Corrected (potentially) small scope variable to 'id'

Review to see if this is problematic

* Updated doc information with "version_added"

* Corrected 'username' in redfish_config file
This commit is contained in:
tomasg2012 2018-11-27 17:16:24 -06:00 committed by ansibot
parent ff9b86f560
commit 07895538b5
3 changed files with 84 additions and 73 deletions

View file

@ -35,30 +35,35 @@ options:
required: true required: true
description: description:
- Base URI of OOB controller - Base URI of OOB controller
user: username:
required: true required: true
description: description:
- User for authentication with OOB controller - User for authentication with OOB controller
version_added: "2.8"
password: password:
required: true required: true
description: description:
- Password for authentication with OOB controller - Password for authentication with OOB controller
userid: id:
required: false required: false
description: description:
- ID of user to add/delete/modify - ID of user to add/delete/modify
username: version_added: "2.8"
new_username:
required: false required: false
description: description:
- name of user to add/delete/modify - name of user to add/delete/modify
userpswd: version_added: "2.8"
new_password:
required: false required: false
description: description:
- password of user to add/delete/modify - password of user to add/delete/modify
userrole: version_added: "2.8"
roleid:
required: false required: false
description: description:
- role of user to add/delete/modify - role of user to add/delete/modify
version_added: "2.8"
bootdevice: bootdevice:
required: false required: false
description: description:
@ -73,7 +78,7 @@ EXAMPLES = '''
category: Systems category: Systems
command: PowerGracefulRestart command: PowerGracefulRestart
baseuri: "{{ baseuri }}" baseuri: "{{ baseuri }}"
user: "{{ user }}" username: "{{ username }}"
password: "{{ password }}" password: "{{ password }}"
- name: Set one-time boot device to {{ bootdevice }} - name: Set one-time boot device to {{ bootdevice }}
@ -82,7 +87,7 @@ EXAMPLES = '''
command: SetOneTimeBoot command: SetOneTimeBoot
bootdevice: "{{ bootdevice }}" bootdevice: "{{ bootdevice }}"
baseuri: "{{ baseuri }}" baseuri: "{{ baseuri }}"
user: "{{ user }}" username: "{{ username }}"
password: "{{ password }}" password: "{{ password }}"
- name: Add and enable user - name: Add and enable user
@ -90,38 +95,38 @@ EXAMPLES = '''
category: Accounts category: Accounts
command: AddUser,EnableUser command: AddUser,EnableUser
baseuri: "{{ baseuri }}" baseuri: "{{ baseuri }}"
user: "{{ user }}"
password: "{{ password }}"
userid: "{{ userid }}"
username: "{{ username }}" username: "{{ username }}"
userpswd: "{{ userpswd }}" password: "{{ password }}"
userrole: "{{ userrole }}" id: "{{ id }}"
new_username: "{{ new_username }}"
new_password: "{{ new_password }}"
roleid: "{{ roleid }}"
- name: Disable and delete user - name: Disable and delete user
redfish_command: redfish_command:
category: Accounts category: Accounts
command: ["DisableUser", "DeleteUser"] command: ["DisableUser", "DeleteUser"]
baseuri: "{{ baseuri }}" baseuri: "{{ baseuri }}"
user: "{{ user }}" username: "{{ username }}"
password: "{{ password }}" password: "{{ password }}"
userid: "{{ userid }}" id: "{{ id }}"
- name: Update user password - name: Update user password
redfish_command: redfish_command:
category: Accounts category: Accounts
command: UpdateUserPassword command: UpdateUserPassword
baseuri: "{{ baseuri }}" baseuri: "{{ baseuri }}"
user: "{{ user }}" username: "{{ username }}"
password: "{{ password }}" password: "{{ password }}"
userid: "{{ userid }}" id: "{{ id }}"
userpswd: "{{ userpswd }}" new_password: "{{ new_password }}"
- name: Clear Manager Logs - name: Clear Manager Logs
redfish_command: redfish_command:
category: Manager category: Manager
command: ClearLogs command: ClearLogs
baseuri: "{{ baseuri }}" baseuri: "{{ baseuri }}"
user: "{{ user }}" username: "{{ username }}"
password: "{{ password }}" password: "{{ password }}"
''' '''
@ -156,12 +161,12 @@ def main():
category=dict(required=True), category=dict(required=True),
command=dict(required=True, type='list'), command=dict(required=True, type='list'),
baseuri=dict(required=True), baseuri=dict(required=True),
user=dict(required=True), username=dict(required=True),
password=dict(required=True, no_log=True), password=dict(required=True, no_log=True),
userid=dict(), id=dict(),
username=dict(), new_username=dict(),
userpswd=dict(no_log=True), new_password=dict(no_log=True),
userrole=dict(), roleid=dict(),
bootdevice=dict(), bootdevice=dict(),
), ),
supports_check_mode=False supports_check_mode=False
@ -171,14 +176,14 @@ def main():
command_list = module.params['command'] command_list = module.params['command']
# admin credentials used for authentication # admin credentials used for authentication
creds = {'user': module.params['user'], creds = {'user': module.params['username'],
'pswd': module.params['password']} 'pswd': module.params['password']}
# user to add/modify/delete # user to add/modify/delete
user = {'userid': module.params['userid'], user = {'userid': module.params['id'],
'username': module.params['username'], 'username': module.params['new_username'],
'userpswd': module.params['userpswd'], 'userpswd': module.params['new_password'],
'userrole': module.params['userrole']} 'userrole': module.params['roleid']}
# Build root URI # Build root URI
root_uri = "https://" + module.params['baseuri'] root_uri = "https://" + module.params['baseuri']

View file

@ -34,34 +34,39 @@ options:
required: true required: true
description: description:
- Base URI of OOB controller - Base URI of OOB controller
user: username:
required: true required: true
description: description:
- User for authentication with OOB controller - User for authentication with OOB controller
version_added: "2.8"
password: password:
required: true required: true
description: description:
- Password for authentication with OOB controller - Password for authentication with OOB controller
bios_attr_name: bios_attribute_name:
required: false required: false
description: description:
- name of BIOS attribute to update - name of BIOS attribute to update
default: 'null' default: 'null'
bios_attr_value: version_added: "2.8"
bios_attribute_value:
required: false required: false
description: description:
- value of BIOS attribute to update - value of BIOS attribute to update
default: 'null' default: 'null'
mgr_attr_name: version_added: "2.8"
manager_attribute_name:
required: false required: false
description: description:
- name of Manager attribute to update - name of Manager attribute to update
default: 'null' default: 'null'
mgr_attr_value: version_added: "2.8"
manager_attribute_value:
required: false required: false
description: description:
- value of Manager attribute to update - value of Manager attribute to update
default: 'null' default: 'null'
version_added: "2.8"
author: "Jose Delarosa (@jose-delarosa)" author: "Jose Delarosa (@jose-delarosa)"
''' '''
@ -71,30 +76,30 @@ EXAMPLES = '''
redfish_config: redfish_config:
category: Systems category: Systems
command: SetBiosAttributes command: SetBiosAttributes
bios_attr_name: BootMode bios_attribute_name: BootMode
bios_attr_value: Uefi bios_attribute_value: Uefi
baseuri: "{{ baseuri }}" baseuri: "{{ baseuri }}"
user: "{{ user }}" username: "{{ username }}"
password: "{{ password }}" password: "{{ password }}"
- name: Set BootMode to Legacy BIOS - name: Set BootMode to Legacy BIOS
redfish_config: redfish_config:
category: Systems category: Systems
command: SetBiosAttributes command: SetBiosAttributes
bios_attr_name: BootMode bios_attribute_name: BootMode
bios_attr_value: Bios bios_attribute_value: Bios
baseuri: "{{ baseuri }}" baseuri: "{{ baseuri }}"
user: "{{ user }}" username: "{{ username }}"
password: "{{ password }}" password: "{{ password }}"
- name: Enable PXE Boot for NIC1 - name: Enable PXE Boot for NIC1
redfish_config: redfish_config:
category: Systems category: Systems
command: SetBiosAttributes command: SetBiosAttributes
bios_attr_name: PxeDev1EnDis bios_attribute_name: PxeDev1EnDis
bios_attr_value: Enabled bios_attribute_value: Enabled
baseuri: "{{ baseuri }}" baseuri: "{{ baseuri }}"
user: "{{ user }}" username: "{{ username }}"
password: "{{ password }}" password: "{{ password }}"
- name: Set BIOS default settings - name: Set BIOS default settings
@ -102,37 +107,37 @@ EXAMPLES = '''
category: Systems category: Systems
command: SetBiosDefaultSettings command: SetBiosDefaultSettings
baseuri: "{{ baseuri }}" baseuri: "{{ baseuri }}"
user: "{{ user }}" username: "{{ username }}"
password: "{{ password }}" password: "{{ password }}"
- name: Enable NTP in the OOB Controller - name: Enable NTP in the OOB Controller
redfish_config: redfish_config:
category: Manager category: Manager
command: SetManagerAttributes command: SetManagerAttributes
mgr_attr_name: NTPConfigGroup.1.NTPEnable manager_attribute_name: NTPConfigGroup.1.NTPEnable
mgr_attr_value: Enabled manager_attribute_value: Enabled
baseuri: "{{ baseuri }}" baseuri: "{{ baseuri }}"
user: "{{ user}}" username: "{{ username}}"
password: "{{ password }}" password: "{{ password }}"
- name: Set NTP server 1 to {{ ntpserver1 }} in the OOB Controller - name: Set NTP server 1 to {{ ntpserver1 }} in the OOB Controller
redfish_config: redfish_config:
category: Manager category: Manager
command: SetManagerAttributes command: SetManagerAttributes
mgr_attr_name: NTPConfigGroup.1.NTP1 manager_attribute_name: NTPConfigGroup.1.NTP1
mgr_attr_value: "{{ ntpserver1 }}" manager_attribute_value: "{{ ntpserver1 }}"
baseuri: "{{ baseuri }}" baseuri: "{{ baseuri }}"
user: "{{ user}}" username: "{{ username}}"
password: "{{ password }}" password: "{{ password }}"
- name: Set Timezone to {{ timezone }} in the OOB Controller - name: Set Timezone to {{ timezone }} in the OOB Controller
redfish_config: redfish_config:
category: Manager category: Manager
command: SetManagerAttributes command: SetManagerAttributes
mgr_attr_name: Time.1.Timezone manager_attribute_name: Time.1.Timezone
mgr_attr_value: "{{ timezone }}" manager_attribute_value: "{{ timezone }}"
baseuri: "{{ baseuri }}" baseuri: "{{ baseuri }}"
user: "{{ user}}" username: "{{ username}}"
password: "{{ password }}" password: "{{ password }}"
''' '''
@ -163,12 +168,12 @@ def main():
category=dict(required=True), category=dict(required=True),
command=dict(required=True, type='list'), command=dict(required=True, type='list'),
baseuri=dict(required=True), baseuri=dict(required=True),
user=dict(required=True), username=dict(required=True),
password=dict(required=True, no_log=True), password=dict(required=True, no_log=True),
mgr_attr_name=dict(default='null'), manager_attribute_name=dict(default='null'),
mgr_attr_value=dict(default='null'), manager_attribute_value=dict(default='null'),
bios_attr_name=dict(default='null'), bios_attribute_name=dict(default='null'),
bios_attr_value=dict(default='null'), bios_attribute_value=dict(default='null'),
), ),
supports_check_mode=False supports_check_mode=False
) )
@ -177,15 +182,15 @@ def main():
command_list = module.params['command'] command_list = module.params['command']
# admin credentials used for authentication # admin credentials used for authentication
creds = {'user': module.params['user'], creds = {'user': module.params['username'],
'pswd': module.params['password']} 'pswd': module.params['password']}
# Manager attributes to update # Manager attributes to update
mgr_attributes = {'mgr_attr_name': module.params['mgr_attr_name'], mgr_attributes = {'mgr_attr_name': module.params['manager_attribute_name'],
'mgr_attr_value': module.params['mgr_attr_value']} 'mgr_attr_value': module.params['manager_attribute_value']}
# BIOS attributes to update # BIOS attributes to update
bios_attributes = {'bios_attr_name': module.params['bios_attr_name'], bios_attributes = {'bios_attr_name': module.params['bios_attribute_name'],
'bios_attr_value': module.params['bios_attr_value']} 'bios_attr_value': module.params['bios_attribute_value']}
# Build root URI # Build root URI
root_uri = "https://" + module.params['baseuri'] root_uri = "https://" + module.params['baseuri']

View file

@ -34,10 +34,11 @@ options:
required: true required: true
description: description:
- Base URI of OOB controller - Base URI of OOB controller
user: username:
required: true required: true
description: description:
- User for authentication with OOB controller - User for authentication with OOB controller
version_added: "2.8"
password: password:
required: true required: true
description: description:
@ -52,7 +53,7 @@ EXAMPLES = '''
category: Systems category: Systems
command: GetCpuInventory command: GetCpuInventory
baseuri: "{{ baseuri }}" baseuri: "{{ baseuri }}"
user: "{{ user }}" username: "{{ username }}"
password: "{{ password }}" password: "{{ password }}"
- name: Get fan inventory - name: Get fan inventory
@ -60,13 +61,13 @@ EXAMPLES = '''
category: Chassis category: Chassis
command: GetFanInventory command: GetFanInventory
baseuri: "{{ baseuri }}" baseuri: "{{ baseuri }}"
user: "{{ user }}" username: "{{ username }}"
password: "{{ password }}" password: "{{ password }}"
- name: Get default inventory information - name: Get default inventory information
redfish_facts: redfish_facts:
baseuri: "{{ baseuri }}" baseuri: "{{ baseuri }}"
user: "{{ user }}" username: "{{ username }}"
password: "{{ password }}" password: "{{ password }}"
- name: Get several inventories - name: Get several inventories
@ -74,21 +75,21 @@ EXAMPLES = '''
category: Systems category: Systems
command: GetNicInventory,GetPsuInventory,GetBiosAttributes command: GetNicInventory,GetPsuInventory,GetBiosAttributes
baseuri: "{{ baseuri }}" baseuri: "{{ baseuri }}"
user: "{{ user }}" username: "{{ username }}"
password: "{{ password }}" password: "{{ password }}"
- name: Get default system inventory and user information - name: Get default system inventory and user information
redfish_facts: redfish_facts:
category: Systems,Accounts category: Systems,Accounts
baseuri: "{{ baseuri }}" baseuri: "{{ baseuri }}"
user: "{{ user }}" 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_facts:
category: ["Systems", "Accounts", "Update"] category: ["Systems", "Accounts", "Update"]
baseuri: "{{ baseuri }}" baseuri: "{{ baseuri }}"
user: "{{ user }}" username: "{{ username }}"
password: "{{ password }}" password: "{{ password }}"
- name: Get all information available in the Manager category - name: Get all information available in the Manager category
@ -96,7 +97,7 @@ EXAMPLES = '''
category: Manager category: Manager
command: all command: all
baseuri: "{{ baseuri }}" baseuri: "{{ baseuri }}"
user: "{{ user }}" username: "{{ username }}"
password: "{{ password }}" password: "{{ password }}"
- name: Get all information available in all categories - name: Get all information available in all categories
@ -104,7 +105,7 @@ EXAMPLES = '''
category: all category: all
command: all command: all
baseuri: "{{ baseuri }}" baseuri: "{{ baseuri }}"
user: "{{ user }}" username: "{{ username }}"
password: "{{ password }}" password: "{{ password }}"
''' '''
@ -147,14 +148,14 @@ def main():
category=dict(type='list', default=['Systems']), category=dict(type='list', default=['Systems']),
command=dict(type='list'), command=dict(type='list'),
baseuri=dict(required=True), baseuri=dict(required=True),
user=dict(required=True), username=dict(required=True),
password=dict(required=True, no_log=True), password=dict(required=True, no_log=True),
), ),
supports_check_mode=False supports_check_mode=False
) )
# admin credentials used for authentication # admin credentials used for authentication
creds = {'user': module.params['user'], creds = {'user': module.params['username'],
'pswd': module.params['password']} 'pswd': module.params['password']}
# Build root URI # Build root URI