Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Integration Test] - idrac_reset #683

Merged
3 changes: 3 additions & 0 deletions tests/integration/targets/idrac_reset/defaults/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
testcase: '[^_].*'
test_items: []
276 changes: 276 additions & 0 deletions tests/integration/targets/idrac_reset/files/ansible_doc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,276 @@
- ' This module resets the iDRAC to factory default settings.'
- ''
- 'ADDED IN: version 2.1.0 of dellemc.openmanage'
- ''
- 'OPTIONS (= is mandatory):'
- ''
- '- ca_path'
- ' The Privacy Enhanced Mail (PEM) file that contains a CA'
- ' certificate to be used for the validation.'
- ' default: null'
- ' type: path'
- ' added in: version 5.0.0 of dellemc.openmanage'
- ''
- ''
- '- custom_defaults_buffer'
- ' This parameter provides the option to import the buffer input'
- ' in XML format as a custom default configuration.'
- ' This option is applicable when `reset_to_default'' is'
- ' `CustomDefaults''.'
- ' `custom_defaults_buffer'' is mutually exclusive with'
- ' `custom_defaults_file''.'
- ' default: null'
- ' type: str'
- ' added in: version 9.2.0 of dellemc.openmanage'
- ''
- ''
- '- custom_defaults_file'
- ' Name of the custom default configuration file in the XML'
- ' format.'
- ' This option is applicable when `reset_to_default'' is'
- ' `CustomDefaults''.'
- ' `custom_defaults_file'' is mutually exclusive with'
- ' `custom_defaults_buffer''.'
- ' default: null'
- ' type: str'
- ' added in: version 9.2.0 of dellemc.openmanage'
- ''
- ''
- '- default_password'
- ' This parameter is only applied when `reset_to_default'' is'
- ' `All'' or `ResetAllWithRootDefaults''.'
- ' This parameter is required to track LifeCycle status of the'
- ' server after the reset operation is performed. If this'
- ' parameter is not provided, then the LifeCycle status is not'
- ' tracked after the reset operation.'
- ' default: null'
- ' type: str'
- ' added in: version 9.4.0 of dellemc.openmanage'
- ''
- ''
- '- default_username'
- ' This parameter is only applied when `reset_to_default'' is'
- ' `All'' or `ResetAllWithRootDefaults''.'
- ' This parameter is required to track LifeCycle status of the'
- ' server after the reset operation is performed. If this'
- ' parameter is not provided, then the LifeCycle status is not'
- ' tracked after the reset operation.'
- ' default: null'
- ' type: str'
- ' added in: version 9.4.0 of dellemc.openmanage'
- ''
- ''
- '- force_reset'
- ' This parameter provides the option to force reset the iDRAC'
- ' without checking the iDRAC lifecycle controller status.'
- ' This option is applicable only for iDRAC9.'
- ' default: false'
- ' type: bool'
- ' added in: version 9.2.0 of dellemc.openmanage'
- ''
- ''
- = idrac_ip
- ' iDRAC IP Address.'
- ' type: str'
- ''
- '- idrac_password'
- ' iDRAC user password.'
- ' If the password is not provided, then the environment variable'
- ' `IDRAC_PASSWORD'' is used.'
- ' Example: export IDRAC_PASSWORD=password'
- ' aliases: [idrac_pwd]'
- ' default: null'
- ' type: str'
- ''
- '- idrac_port'
- ' iDRAC port.'
- ' default: 443'
- ' type: int'
- ''
- '- idrac_user'
- ' iDRAC username.'
- ' If the username is not provided, then the environment variable'
- ' `IDRAC_USERNAME'' is used.'
- ' Example: export IDRAC_USERNAME=username'
- ' default: null'
- ' type: str'
- ''
- '- job_wait_timeout'
- ' Time in seconds to wait for job completion.'
- ' This is applicable when `wait_for_idrac'' is `true''.'
- ' default: 600'
- ' type: int'
- ' added in: version 9.2.0 of dellemc.openmanage'
- ''
- ''
- '- reset_to_default'
- ' If this value is not set the default behaviour is to restart'
- ' the iDRAC.'
- ' `All'' Discards all settings and reset to default credentials.'
- ' `ResetAllWithRootDefaults'' Discards all settings and reset the'
- ' default username to root and password to the shipping value.'
- ' `Default'' Discards all settings, but preserves user and'
- ' network settings.'
- ' `CustomDefaults'' All configuration is set to custom'
- ' defaults.This option is supported on firmware version'
- ' 7.00.00.00 and newer versions.'
- ' choices: [Default, All, ResetAllWithRootDefaults, CustomDefaults]'
- ' default: null'
- ' type: str'
- ' added in: version 9.2.0 of dellemc.openmanage'
- ''
- ''
- '- timeout'
- ' The socket level timeout in seconds.'
- ' default: 30'
- ' type: int'
- ' added in: version 5.0.0 of dellemc.openmanage'
- ''
- ''
- '- validate_certs'
- ' If `false'', the SSL certificates will not be validated.'
- ' Configure `false'' only on personally controlled sites where'
- ' self-signed certificates are used.'
- ' Prior to collection version `5.0.0'', the `validate_certs'' is'
- ' `false'' by default.'
- ' default: true'
- ' type: bool'
- ' added in: version 5.0.0 of dellemc.openmanage'
- ''
- ''
- '- wait_for_idrac'
- ' This parameter provides the option to wait for the iDRAC to'
- ' reset and lifecycle controller status to be ready.'
- ' default: true'
- ' type: bool'
- ' added in: version 9.2.0 of dellemc.openmanage'
- ''
- ''
- '- x_auth_token'
- ' Authentication token.'
- ' If the x_auth_token is not provided, then the environment'
- ' variable `IDRAC_X_AUTH_TOKEN'' is used.'
- ' Example: export IDRAC_X_AUTH_TOKEN=x_auth_token'
- ' default: null'
- ' type: str'
- ' added in: version 9.3.0 of dellemc.openmanage'
- ''
- ''
- ''
- 'NOTES:'
- ' * Run this module from a system that has direct access to'
- ' Dell iDRAC.'
- ' * This module supports both IPv4 and IPv6 address for'
- ' `idrac_ip''.'
- ' * This module supports `check_mode''.'
- ' * If reset_to_default option is not specified, then this'
- ' module triggers a graceful restart.'
- ' * This module skips the execution if reset options are not'
- ' supported by the iDRAC.'
- ''
- ''
- 'REQUIREMENTS: python >= 3.9.6'
- ''
- 'AUTHOR: Felix Stephen (@felixs88), Anooja Vardhineni (@anooja-vardhineni), Lovepreet
Singh (@singh-lovepreet1), Abhishek Sinha (@ABHISHEK-SINHA10)'
- ''
- 'EXAMPLES:'
- ''
- '---'
- '- name: Reset the iDRAC to default and do not wait till the iDRAC is accessible.'
- ' dellemc.openmanage.idrac_reset:'
- ' idrac_ip: "192.168.0.1"'
- ' idrac_user: "user_name"'
- ' idrac_password: "user_password"'
- ' ca_path: "/path/to/ca_cert.pem"'
- ' reset_to_default: "Default"'
- ' wait_for_idrac: false'
- ''
- '- name: Reset the iDRAC to All and wait for lifecycle controller status to be ready.'
- ' dellemc.openmanage.idrac_reset:'
- ' idrac_ip: "192.168.0.1"'
- ' idrac_user: "user_name"'
- ' idrac_password: "user_password"'
- ' ca_path: "/path/to/ca_cert.pem"'
- ' reset_to_default: "All"'
- ' wait_for_idrac: true'
- ' default_username: "user_name"'
- ' default_password: "user_password"'
- ''
- '- name: Force reset the iDRAC to default.'
- ' dellemc.openmanage.idrac_reset:'
- ' idrac_ip: "192.168.0.1"'
- ' idrac_user: "user_name"'
- ' idrac_password: "user_password"'
- ' ca_path: "/path/to/ca_cert.pem"'
- ' reset_to_default: "Default"'
- ' force_reset: true'
- ''
- '- name: Gracefully restart the iDRAC.'
- ' dellemc.openmanage.idrac_reset:'
- ' idrac_ip: "192.168.0.1"'
- ' idrac_user: "user_name"'
- ' idrac_password: "user_password"'
- ' ca_path: "/path/to/ca_cert.pem"'
- ''
- '- name: Reset the iDRAC to custom defaults XML and do not wait till the iDRAC is
accessible.'
- ' dellemc.openmanage.idrac_reset:'
- ' idrac_ip: "192.168.0.1"'
- ' idrac_user: "user_name"'
- ' idrac_password: "user_password"'
- ' ca_path: "/path/to/ca_cert.pem"'
- ' reset_to_default: "CustomDefaults"'
- ' custom_defaults_file: "/path/to/custom_defaults.xml"'
- ''
- '- name: Reset the iDRAC to custom defaults buffer input and do not wait till the
iDRAC is accessible.'
- ' dellemc.openmanage.idrac_reset:'
- ' idrac_ip: "192.168.0.1"'
- ' idrac_user: "user_name"'
- ' idrac_password: "user_password"'
- ' ca_path: "/path/to/ca_cert.pem"'
- ' reset_to_default: "CustomDefaults"'
- ' custom_defaults_buffer: "<SystemConfiguration Model=\"PowerEdge R7525\" ServiceTag=\"ABCD123\">\n<Component
FQDD=\"iDRAC.Embedded.1\">\n'
- ' <Attribute Name=\"IPMILan.1#Enable\">Disabled</Attribute>\n
</Component>\n\n</SystemConfiguration>"'
- ''
- ''
- 'RETURN VALUES:'
- '- error_info'
- ' Details of the HTTP Error.'
- ' returned: on HTTP error'
- ' sample:'
- ' error:'
- ' ''@Message.ExtendedInfo'':'
- ' - Message: Unable to process the request because an error occurred.'
- ' MessageArgs: []'
- ' MessageId: GEN1234'
- ' RelatedProperties: []'
- ' Resolution: Retry the operation. If the issue persists, contact your
system'
- ' administrator.'
- ' Severity: Critical'
- ' code: Base.1.0.GeneralError'
- ' message: A general error has occurred. See ExtendedInfo for more information.'
- ' type: dict'
- ''
- '- msg'
- ' Status of the iDRAC reset operation.'
- ' returned: always'
- ' sample: Successfully performed iDRAC reset.'
- ' type: str'
- ''
- '- reset_status'
- ' Details of iDRAC reset operation.'
- ' returned: reset operation is triggered.'
- ' sample:'
- ' idracreset:'
- ' Data:'
- ' StatusCode: 204'
- ' Message: none'
- ' Status: Success'
- ' StatusCode: 204'
- ' retval: true'
- ' type: dict'
3 changes: 3 additions & 0 deletions tests/integration/targets/idrac_reset/meta/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
dependencies:
- prepare_idrac_lifecycle_controller_status
23 changes: 23 additions & 0 deletions tests/integration/targets/idrac_reset/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
- name: Collect all test cases
ansible.builtin.find:
paths: '{{ role_path }}/tests'
patterns: '{{ testcase }}.yaml'
use_regex: true
register: test_cases
delegate_to: localhost

- name: Set test_items
ansible.builtin.set_fact:
test_items: "{{ test_cases.files | map(attribute='path') | list }}"

- name: Fail if no test cases are found as per pattern.
ansible.builtin.fail:
msg: "Could not find test cases to run!!!"
when: not test_items|length > 0

- name: Run test case
ansible.builtin.include_tasks: '{{ test_case_to_run }}'
with_items: '{{ test_items }}'
loop_control:
loop_var: test_case_to_run
Loading
Loading