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

View file

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

View file

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