From 97514612956083d585c1141ec3dbb57483519162 Mon Sep 17 00:00:00 2001 From: Alexei Znamensky <103110+russoz@users.noreply.github.com> Date: Thu, 26 Dec 2024 09:19:49 +1300 Subject: [PATCH] r*: normalize docs (#9354) * r*: normalize docs * Apply suggestions from code review Co-authored-by: Felix Fontein * Apply suggestions from code review --------- Co-authored-by: Felix Fontein --- plugins/modules/read_csv.py | 68 +- plugins/modules/redfish_command.py | 957 +++++++++--------- plugins/modules/redfish_config.py | 369 ++++--- plugins/modules/redfish_info.py | 542 +++++----- plugins/modules/redhat_subscription.py | 323 +++--- plugins/modules/redis.py | 144 ++- plugins/modules/redis_data.py | 106 +- plugins/modules/redis_data_incr.py | 37 +- plugins/modules/redis_data_info.py | 13 +- plugins/modules/redis_info.py | 23 +- plugins/modules/rhevm.py | 377 ++++--- plugins/modules/rhsm_release.py | 25 +- plugins/modules/rhsm_repository.py | 38 +- plugins/modules/riak.py | 27 +- plugins/modules/rocketchat.py | 41 +- plugins/modules/rollbar_deployment.py | 47 +- plugins/modules/rpm_ostree_pkg.py | 127 ++- plugins/modules/rundeck_acl_policy.py | 129 ++- .../modules/rundeck_job_executions_info.py | 102 +- plugins/modules/rundeck_job_run.py | 125 ++- plugins/modules/rundeck_project.py | 107 +- plugins/modules/runit.py | 78 +- 22 files changed, 1858 insertions(+), 1947 deletions(-) diff --git a/plugins/modules/read_csv.py b/plugins/modules/read_csv.py index 3c59013180..ce2631482b 100644 --- a/plugins/modules/read_csv.py +++ b/plugins/modules/read_csv.py @@ -8,16 +8,15 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -DOCUMENTATION = r''' ---- +DOCUMENTATION = r""" module: read_csv short_description: Read a CSV file description: -- Read a CSV file and return a list or a dictionary, containing one dictionary per row. + - Read a CSV file and return a list or a dictionary, containing one dictionary per row. author: -- Dag Wieers (@dagwieers) + - Dag Wieers (@dagwieers) extends_documentation_fragment: -- community.general.attributes + - community.general.attributes attributes: check_mode: support: full @@ -26,58 +25,57 @@ attributes: options: path: description: - - The CSV filename to read data from. + - The CSV filename to read data from. type: path required: true - aliases: [ filename ] + aliases: [filename] key: description: - - The column name used as a key for the resulting dictionary. - - If O(key) is unset, the module returns a list of dictionaries, - where each dictionary is a row in the CSV file. + - The column name used as a key for the resulting dictionary. + - If O(key) is unset, the module returns a list of dictionaries, where each dictionary is a row in the CSV file. type: str dialect: description: - - The CSV dialect to use when parsing the CSV file. - - Possible values include V(excel), V(excel-tab) or V(unix). + - The CSV dialect to use when parsing the CSV file. + - Possible values include V(excel), V(excel-tab) or V(unix). type: str default: excel fieldnames: description: - - A list of field names for every column. - - This is needed if the CSV does not have a header. + - A list of field names for every column. + - This is needed if the CSV does not have a header. type: list elements: str unique: description: - - Whether the O(key) used is expected to be unique. + - Whether the O(key) used is expected to be unique. type: bool default: true delimiter: description: - - A one-character string used to separate fields. - - When using this parameter, you change the default value used by O(dialect). - - The default value depends on the dialect used. + - A one-character string used to separate fields. + - When using this parameter, you change the default value used by O(dialect). + - The default value depends on the dialect used. type: str skipinitialspace: description: - - Whether to ignore any whitespaces immediately following the delimiter. - - When using this parameter, you change the default value used by O(dialect). - - The default value depends on the dialect used. + - Whether to ignore any whitespaces immediately following the delimiter. + - When using this parameter, you change the default value used by O(dialect). + - The default value depends on the dialect used. type: bool strict: description: - - Whether to raise an exception on bad CSV input. - - When using this parameter, you change the default value used by O(dialect). - - The default value depends on the dialect used. + - Whether to raise an exception on bad CSV input. + - When using this parameter, you change the default value used by O(dialect). + - The default value depends on the dialect used. type: bool seealso: - plugin: ansible.builtin.csvfile plugin_type: lookup description: Can be used to do selective lookups in CSV files from Jinja. -''' +""" -EXAMPLES = r''' +EXAMPLES = r""" # Example CSV file with header # # name,uid,gid @@ -118,9 +116,9 @@ EXAMPLES = r''' delimiter: ';' register: users delegate_to: localhost -''' +""" -RETURN = r''' +RETURN = r""" dict: description: The CSV content as a dictionary. returned: success @@ -139,13 +137,13 @@ list: returned: success type: list sample: - - name: dag - uid: 500 - gid: 500 - - name: jeroen - uid: 501 - gid: 500 -''' + - name: dag + uid: 500 + gid: 500 + - name: jeroen + uid: 501 + gid: 500 +""" from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.common.text.converters import to_native diff --git a/plugins/modules/redfish_command.py b/plugins/modules/redfish_command.py index 829b77897d..edbbb18e5f 100644 --- a/plugins/modules/redfish_command.py +++ b/plugins/modules/redfish_command.py @@ -8,13 +8,11 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -DOCUMENTATION = ''' ---- +DOCUMENTATION = r""" module: redfish_command short_description: Manages Out-Of-Band controllers using Redfish APIs description: - - Builds Redfish URIs locally and sends them to remote OOB controllers to - perform an action. + - Builds Redfish URIs locally and sends them to remote OOB controllers to perform an action. - Manages OOB controller ex. reboot, log management. - Manages OOB controller users ex. add, remove, update. - Manages system power ex. on, off, graceful and forced reboot. @@ -62,32 +60,32 @@ options: version_added: 2.3.0 id: required: false - aliases: [ account_id ] + aliases: [account_id] description: - ID of account to delete/modify. - Can also be used in account creation to work around vendor issues where the ID of the new user is required in the POST request. type: str new_username: required: false - aliases: [ account_username ] + aliases: [account_username] description: - Username of account to add/delete/modify. type: str new_password: required: false - aliases: [ account_password ] + aliases: [account_password] description: - New password of account to add/modify. type: str roleid: required: false - aliases: [ account_roleid ] + aliases: [account_roleid] description: - Role of account to add/modify. type: str account_types: required: false - aliases: [ account_accounttypes ] + aliases: [account_accounttypes] description: - Array of account types to apply to a user account. type: list @@ -95,7 +93,7 @@ options: version_added: '7.2.0' oem_account_types: required: false - aliases: [ account_oemaccounttypes ] + aliases: [account_oemaccounttypes] description: - Array of OEM account types to apply to a user account. type: list @@ -109,15 +107,14 @@ options: timeout: description: - Timeout in seconds for HTTP requests to OOB controller. - - The default value for this parameter changed from V(10) to V(60) - in community.general 9.0.0. + - The default value for this parameter changed from V(10) to V(60) in community.general 9.0.0. type: int default: 60 boot_override_mode: description: - Boot mode when using an override. type: str - choices: [ Legacy, UEFI ] + choices: [Legacy, UEFI] version_added: 3.5.0 uefi_target: required: false @@ -131,7 +128,7 @@ options: type: str update_username: required: false - aliases: [ account_updatename ] + aliases: [account_updatename] description: - New user name for updating account_username. type: str @@ -219,11 +216,9 @@ options: update_custom_oem_header: required: false description: - - Optional OEM header, sent as separate form-data for - the Multipart HTTP push update. - - The header shall start with "Oem" according to DMTF - Redfish spec 12.6.2.2. - - For more details, see U(https://www.dmtf.org/sites/default/files/standards/documents/DSP0266_1.21.0.html) + - Optional OEM header, sent as separate form-data for the Multipart HTTP push update. + - The header shall start with "Oem" according to DMTF Redfish spec 12.6.2.2. + - For more details, see U(https://www.dmtf.org/sites/default/files/standards/documents/DSP0266_1.21.0.html). - If set, then O(update_custom_oem_params) is required too. type: str version_added: '10.1.0' @@ -232,18 +227,15 @@ options: description: - Custom OEM properties for HTTP Multipart Push updates. - If set, then O(update_custom_oem_header) is required too. - - The properties will be passed raw without any validation or conversion by Ansible. - This means the content can be a file, a string, or any other data. - If the content is a dict that should be converted to JSON, then the - content must be converted to JSON before passing it to this module using the - P(ansible.builtin.to_json#filter) filter. + - The properties will be passed raw without any validation or conversion by Ansible. This means the content can be a file, a string, or + any other data. If the content is a dict that should be converted to JSON, then the content must be converted to JSON before passing it + to this module using the P(ansible.builtin.to_json#filter) filter. type: raw version_added: '10.1.0' update_custom_oem_mime_type: required: false description: - - MIME Type for custom OEM properties for HTTP Multipart - Push updates. + - MIME Type for custom OEM properties for HTTP Multipart Push updates. type: str version_added: '10.1.0' virtual_media: @@ -299,10 +291,8 @@ options: type: str strip_etag_quotes: description: - - Removes surrounding quotes of etag used in C(If-Match) header - of C(PATCH) requests. - - Only use this option to resolve bad vendor implementation where - C(If-Match) only matches the unquoted etag string. + - Removes surrounding quotes of etag used in C(If-Match) header of C(PATCH) requests. + - Only use this option to resolve bad vendor implementation where C(If-Match) only matches the unquoted etag string. type: bool default: false version_added: 3.7.0 @@ -316,7 +306,7 @@ options: description: - Mode to apply when reseting to default. type: str - choices: [ ResetAll, PreserveNetworkAndUsers, PreserveNetwork ] + choices: [ResetAll, PreserveNetworkAndUsers, PreserveNetwork] version_added: 8.6.0 wait: required: false @@ -336,9 +326,8 @@ options: required: false description: - SSL/TLS Ciphers to use for the request. - - 'When a list is provided, all ciphers are joined in order with V(:).' - - See the L(OpenSSL Cipher List Format,https://www.openssl.org/docs/manmaster/man1/openssl-ciphers.html#CIPHER-LIST-FORMAT) - for more details. + - When a list is provided, all ciphers are joined in order with V(:). + - See the L(OpenSSL Cipher List Format,https://www.openssl.org/docs/manmaster/man1/openssl-ciphers.html#CIPHER-LIST-FORMAT) for more details. - The available ciphers is dependent on the Python and OpenSSL/LibreSSL versions. type: list elements: str @@ -347,514 +336,512 @@ options: author: - "Jose Delarosa (@jose-delarosa)" - "T S Kushal (@TSKushal)" -''' +""" -EXAMPLES = ''' - - name: Restart system power gracefully - community.general.redfish_command: - category: Systems - command: PowerGracefulRestart - resource_id: 437XR1138R2 - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +EXAMPLES = r""" +- name: Restart system power gracefully + community.general.redfish_command: + category: Systems + command: PowerGracefulRestart + resource_id: 437XR1138R2 + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Turn system power off - community.general.redfish_command: - category: Systems - command: PowerForceOff - resource_id: 437XR1138R2 +- name: Turn system power off + community.general.redfish_command: + category: Systems + command: PowerForceOff + resource_id: 437XR1138R2 - - name: Restart system power forcefully - community.general.redfish_command: - category: Systems - command: PowerForceRestart - resource_id: 437XR1138R2 +- name: Restart system power forcefully + community.general.redfish_command: + category: Systems + command: PowerForceRestart + resource_id: 437XR1138R2 - - name: Shutdown system power gracefully - community.general.redfish_command: - category: Systems - command: PowerGracefulShutdown - resource_id: 437XR1138R2 +- name: Shutdown system power gracefully + community.general.redfish_command: + category: Systems + command: PowerGracefulShutdown + resource_id: 437XR1138R2 - - name: Turn system power on - community.general.redfish_command: - category: Systems - command: PowerOn - resource_id: 437XR1138R2 +- name: Turn system power on + community.general.redfish_command: + category: Systems + command: PowerOn + resource_id: 437XR1138R2 - - name: Reboot system power - community.general.redfish_command: - category: Systems - command: PowerReboot - resource_id: 437XR1138R2 +- name: Reboot system power + community.general.redfish_command: + category: Systems + command: PowerReboot + resource_id: 437XR1138R2 - - name: Set one-time boot device to {{ bootdevice }} - community.general.redfish_command: - category: Systems - command: SetOneTimeBoot - resource_id: 437XR1138R2 - bootdevice: "{{ bootdevice }}" - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Set one-time boot device to {{ bootdevice }} + community.general.redfish_command: + category: Systems + command: SetOneTimeBoot + resource_id: 437XR1138R2 + bootdevice: "{{ bootdevice }}" + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Set one-time boot device to UefiTarget of "/0x31/0x33/0x01/0x01" - community.general.redfish_command: - category: Systems - command: SetOneTimeBoot - resource_id: 437XR1138R2 - bootdevice: "UefiTarget" - uefi_target: "/0x31/0x33/0x01/0x01" - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Set one-time boot device to UefiTarget of "/0x31/0x33/0x01/0x01" + community.general.redfish_command: + category: Systems + command: SetOneTimeBoot + resource_id: 437XR1138R2 + bootdevice: "UefiTarget" + uefi_target: "/0x31/0x33/0x01/0x01" + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Set one-time boot device to BootNext target of "Boot0001" - community.general.redfish_command: - category: Systems - command: SetOneTimeBoot - resource_id: 437XR1138R2 - bootdevice: "UefiBootNext" - boot_next: "Boot0001" - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Set one-time boot device to BootNext target of "Boot0001" + community.general.redfish_command: + category: Systems + command: SetOneTimeBoot + resource_id: 437XR1138R2 + bootdevice: "UefiBootNext" + boot_next: "Boot0001" + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Set persistent boot device override - community.general.redfish_command: - category: Systems - command: EnableContinuousBootOverride - resource_id: 437XR1138R2 - bootdevice: "{{ bootdevice }}" - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Set persistent boot device override + community.general.redfish_command: + category: Systems + command: EnableContinuousBootOverride + resource_id: 437XR1138R2 + bootdevice: "{{ bootdevice }}" + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Set one-time boot to BiosSetup - community.general.redfish_command: - category: Systems - command: SetOneTimeBoot - boot_next: BiosSetup - boot_override_mode: Legacy - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Set one-time boot to BiosSetup + community.general.redfish_command: + category: Systems + command: SetOneTimeBoot + boot_next: BiosSetup + boot_override_mode: Legacy + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Disable persistent boot device override - community.general.redfish_command: - category: Systems - command: DisableBootOverride +- name: Disable persistent boot device override + community.general.redfish_command: + category: Systems + command: DisableBootOverride - - name: Set system indicator LED to blink using security token for auth - community.general.redfish_command: - category: Systems - command: IndicatorLedBlink - resource_id: 437XR1138R2 - baseuri: "{{ baseuri }}" - auth_token: "{{ result.session.token }}" +- name: Set system indicator LED to blink using security token for auth + community.general.redfish_command: + category: Systems + command: IndicatorLedBlink + resource_id: 437XR1138R2 + baseuri: "{{ baseuri }}" + auth_token: "{{ result.session.token }}" - - name: Add user - community.general.redfish_command: - category: Accounts - command: AddUser - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - new_username: "{{ new_username }}" - new_password: "{{ new_password }}" - roleid: "{{ roleid }}" +- name: Add user + community.general.redfish_command: + category: Accounts + command: AddUser + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + new_username: "{{ new_username }}" + new_password: "{{ new_password }}" + roleid: "{{ roleid }}" - - name: Add user with specified account types - community.general.redfish_command: - category: Accounts - command: AddUser - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - new_username: "{{ new_username }}" - new_password: "{{ new_password }}" - roleid: "{{ roleid }}" - account_types: +- name: Add user with specified account types + community.general.redfish_command: + category: Accounts + command: AddUser + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + new_username: "{{ new_username }}" + new_password: "{{ new_password }}" + roleid: "{{ roleid }}" + account_types: - Redfish - WebUI - - name: Add user using new option aliases - community.general.redfish_command: - category: Accounts - command: AddUser - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - account_username: "{{ account_username }}" - account_password: "{{ account_password }}" - account_roleid: "{{ account_roleid }}" +- name: Add user using new option aliases + community.general.redfish_command: + category: Accounts + command: AddUser + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + account_username: "{{ account_username }}" + account_password: "{{ account_password }}" + account_roleid: "{{ account_roleid }}" - - name: Delete user - community.general.redfish_command: - category: Accounts - command: DeleteUser - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - account_username: "{{ account_username }}" +- name: Delete user + community.general.redfish_command: + category: Accounts + command: DeleteUser + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + account_username: "{{ account_username }}" - - name: Disable user - community.general.redfish_command: - category: Accounts - command: DisableUser - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - account_username: "{{ account_username }}" +- name: Disable user + community.general.redfish_command: + category: Accounts + command: DisableUser + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + account_username: "{{ account_username }}" - - name: Enable user - community.general.redfish_command: - category: Accounts - command: EnableUser - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - account_username: "{{ account_username }}" +- name: Enable user + community.general.redfish_command: + category: Accounts + command: EnableUser + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + account_username: "{{ account_username }}" - - name: Add and enable user - community.general.redfish_command: - category: Accounts - command: AddUser,EnableUser - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - new_username: "{{ new_username }}" - new_password: "{{ new_password }}" - roleid: "{{ roleid }}" +- name: Add and enable user + community.general.redfish_command: + category: Accounts + command: AddUser,EnableUser + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + new_username: "{{ new_username }}" + new_password: "{{ new_password }}" + roleid: "{{ roleid }}" - - name: Update user password - community.general.redfish_command: - category: Accounts - command: UpdateUserPassword - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - account_username: "{{ account_username }}" - account_password: "{{ account_password }}" +- name: Update user password + community.general.redfish_command: + category: Accounts + command: UpdateUserPassword + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + account_username: "{{ account_username }}" + account_password: "{{ account_password }}" - - name: Update user role - community.general.redfish_command: - category: Accounts - command: UpdateUserRole - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - account_username: "{{ account_username }}" - roleid: "{{ roleid }}" +- name: Update user role + community.general.redfish_command: + category: Accounts + command: UpdateUserRole + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + account_username: "{{ account_username }}" + roleid: "{{ roleid }}" - - name: Update user name - community.general.redfish_command: - category: Accounts - command: UpdateUserName - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - account_username: "{{ account_username }}" - account_updatename: "{{ account_updatename }}" +- name: Update user name + community.general.redfish_command: + category: Accounts + command: UpdateUserName + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + account_username: "{{ account_username }}" + account_updatename: "{{ account_updatename }}" - - name: Update user name - community.general.redfish_command: - category: Accounts - command: UpdateUserName - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - account_username: "{{ account_username }}" - update_username: "{{ update_username }}" +- name: Update user name + community.general.redfish_command: + category: Accounts + command: UpdateUserName + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + account_username: "{{ account_username }}" + update_username: "{{ update_username }}" - - name: Update AccountService properties - community.general.redfish_command: - category: Accounts - command: UpdateAccountServiceProperties - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - account_properties: - AccountLockoutThreshold: 5 - AccountLockoutDuration: 600 +- name: Update AccountService properties + community.general.redfish_command: + category: Accounts + command: UpdateAccountServiceProperties + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + account_properties: + AccountLockoutThreshold: 5 + AccountLockoutDuration: 600 - - name: Update user AccountTypes - community.general.redfish_command: - category: Accounts - command: UpdateUserAccountTypes - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - account_username: "{{ account_username }}" - account_types: - - Redfish - - WebUI +- name: Update user AccountTypes + community.general.redfish_command: + category: Accounts + command: UpdateUserAccountTypes + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + account_username: "{{ account_username }}" + account_types: + - Redfish + - WebUI - - name: Clear Manager Logs with a timeout of 20 seconds - community.general.redfish_command: - category: Manager - command: ClearLogs - resource_id: BMC - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - timeout: 20 +- name: Clear Manager Logs with a timeout of 20 seconds + community.general.redfish_command: + category: Manager + command: ClearLogs + resource_id: BMC + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + timeout: 20 - - name: Create session - community.general.redfish_command: - category: Sessions - command: CreateSession - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - register: result +- name: Create session + community.general.redfish_command: + category: Sessions + command: CreateSession + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + register: result - - name: Set chassis indicator LED to blink using security token for auth - community.general.redfish_command: - category: Chassis - command: IndicatorLedBlink - resource_id: 1U - baseuri: "{{ baseuri }}" - auth_token: "{{ result.session.token }}" +- name: Set chassis indicator LED to blink using security token for auth + community.general.redfish_command: + category: Chassis + command: IndicatorLedBlink + resource_id: 1U + baseuri: "{{ baseuri }}" + auth_token: "{{ result.session.token }}" - - name: Delete session using security token created by CreateSesssion above - community.general.redfish_command: - category: Sessions - command: DeleteSession - baseuri: "{{ baseuri }}" - auth_token: "{{ result.session.token }}" - session_uri: "{{ result.session.uri }}" +- name: Delete session using security token created by CreateSesssion above + community.general.redfish_command: + category: Sessions + command: DeleteSession + baseuri: "{{ baseuri }}" + auth_token: "{{ result.session.token }}" + session_uri: "{{ result.session.uri }}" - - name: Clear Sessions - community.general.redfish_command: - category: Sessions - command: ClearSessions - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Clear Sessions + community.general.redfish_command: + category: Sessions + command: ClearSessions + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Simple update - community.general.redfish_command: - category: Update - command: SimpleUpdate - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - update_image_uri: https://example.com/myupdate.img +- name: Simple update + community.general.redfish_command: + category: Update + command: SimpleUpdate + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + update_image_uri: https://example.com/myupdate.img - - name: Simple update with additional options - community.general.redfish_command: - category: Update - command: SimpleUpdate - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - update_image_uri: //example.com/myupdate.img - update_protocol: FTP - update_targets: - - /redfish/v1/UpdateService/FirmwareInventory/BMC - update_creds: - username: operator - password: supersecretpwd +- name: Simple update with additional options + community.general.redfish_command: + category: Update + command: SimpleUpdate + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + update_image_uri: //example.com/myupdate.img + update_protocol: FTP + update_targets: + - /redfish/v1/UpdateService/FirmwareInventory/BMC + update_creds: + username: operator + password: supersecretpwd - - name: Multipart HTTP push update; timeout is 600 seconds to allow for a - large image transfer - community.general.redfish_command: - category: Update - command: MultipartHTTPPushUpdate - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - timeout: 600 - update_image_file: ~/images/myupdate.img +- name: Multipart HTTP push update; timeout is 600 seconds to allow for a large image transfer + community.general.redfish_command: + category: Update + command: MultipartHTTPPushUpdate + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + timeout: 600 + update_image_file: ~/images/myupdate.img - - name: Multipart HTTP push with additional options; timeout is 600 seconds - to allow for a large image transfer - community.general.redfish_command: - category: Update - command: MultipartHTTPPushUpdate - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - timeout: 600 - update_image_file: ~/images/myupdate.img - update_targets: - - /redfish/v1/UpdateService/FirmwareInventory/BMC - update_oem_params: - PreserveConfiguration: false +- name: Multipart HTTP push with additional options; timeout is 600 seconds to allow for a large image transfer + community.general.redfish_command: + category: Update + command: MultipartHTTPPushUpdate + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + timeout: 600 + update_image_file: ~/images/myupdate.img + update_targets: + - /redfish/v1/UpdateService/FirmwareInventory/BMC + update_oem_params: + PreserveConfiguration: false - - name: Multipart HTTP push with custom OEM options - vars: - oem_payload: - ImageType: BMC - community.general.redfish_command: - category: Update - command: MultipartHTTPPushUpdate - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - update_image_file: ~/images/myupdate.img - update_targets: - - /redfish/v1/UpdateService/FirmwareInventory/BMC - update_custom_oem_header: OemParameters - update_custom_oem_mime_type: "application/json" - update_custom_oem_params: "{{ oem_payload | to_json }}" +- name: Multipart HTTP push with custom OEM options + vars: + oem_payload: + ImageType: BMC + community.general.redfish_command: + category: Update + command: MultipartHTTPPushUpdate + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + update_image_file: ~/images/myupdate.img + update_targets: + - /redfish/v1/UpdateService/FirmwareInventory/BMC + update_custom_oem_header: OemParameters + update_custom_oem_mime_type: "application/json" + update_custom_oem_params: "{{ oem_payload | to_json }}" - - name: Perform requested operations to continue the update - community.general.redfish_command: - category: Update - command: PerformRequestedOperations - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - update_handle: /redfish/v1/TaskService/TaskMonitors/735 +- name: Perform requested operations to continue the update + community.general.redfish_command: + category: Update + command: PerformRequestedOperations + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + update_handle: /redfish/v1/TaskService/TaskMonitors/735 - - name: Insert Virtual Media - community.general.redfish_command: - category: Systems - command: VirtualMediaInsert - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - virtual_media: - image_url: 'http://example.com/images/SomeLinux-current.iso' - media_types: - - CD - - DVD - resource_id: 1 +- name: Insert Virtual Media + community.general.redfish_command: + category: Systems + command: VirtualMediaInsert + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + virtual_media: + image_url: 'http://example.com/images/SomeLinux-current.iso' + media_types: + - CD + - DVD + resource_id: 1 - - name: Insert Virtual Media - community.general.redfish_command: - category: Manager - command: VirtualMediaInsert - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - virtual_media: - image_url: 'http://example.com/images/SomeLinux-current.iso' - media_types: - - CD - - DVD - resource_id: BMC +- name: Insert Virtual Media + community.general.redfish_command: + category: Manager + command: VirtualMediaInsert + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + virtual_media: + image_url: 'http://example.com/images/SomeLinux-current.iso' + media_types: + - CD + - DVD + resource_id: BMC - - name: Eject Virtual Media - community.general.redfish_command: - category: Systems - command: VirtualMediaEject - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - virtual_media: - image_url: 'http://example.com/images/SomeLinux-current.iso' - resource_id: 1 +- name: Eject Virtual Media + community.general.redfish_command: + category: Systems + command: VirtualMediaEject + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + virtual_media: + image_url: 'http://example.com/images/SomeLinux-current.iso' + resource_id: 1 - - name: Eject Virtual Media - community.general.redfish_command: - category: Manager - command: VirtualMediaEject - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - virtual_media: - image_url: 'http://example.com/images/SomeLinux-current.iso' - resource_id: BMC +- name: Eject Virtual Media + community.general.redfish_command: + category: Manager + command: VirtualMediaEject + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + virtual_media: + image_url: 'http://example.com/images/SomeLinux-current.iso' + resource_id: BMC - - name: Restart manager power gracefully - community.general.redfish_command: - category: Manager - command: GracefulRestart - resource_id: BMC - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Restart manager power gracefully + community.general.redfish_command: + category: Manager + command: GracefulRestart + resource_id: BMC + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Restart manager power gracefully and wait for it to be available - community.general.redfish_command: - category: Manager - command: GracefulRestart - resource_id: BMC - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - wait: True +- name: Restart manager power gracefully and wait for it to be available + community.general.redfish_command: + category: Manager + command: GracefulRestart + resource_id: BMC + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + wait: true - - name: Restart manager power gracefully - community.general.redfish_command: - category: Manager - command: PowerGracefulRestart - resource_id: BMC +- name: Restart manager power gracefully + community.general.redfish_command: + category: Manager + command: PowerGracefulRestart + resource_id: BMC - - name: Turn manager power off - community.general.redfish_command: - category: Manager - command: PowerForceOff - resource_id: BMC +- name: Turn manager power off + community.general.redfish_command: + category: Manager + command: PowerForceOff + resource_id: BMC - - name: Restart manager power forcefully - community.general.redfish_command: - category: Manager - command: PowerForceRestart - resource_id: BMC +- name: Restart manager power forcefully + community.general.redfish_command: + category: Manager + command: PowerForceRestart + resource_id: BMC - - name: Shutdown manager power gracefully - community.general.redfish_command: - category: Manager - command: PowerGracefulShutdown - resource_id: BMC +- name: Shutdown manager power gracefully + community.general.redfish_command: + category: Manager + command: PowerGracefulShutdown + resource_id: BMC - - name: Turn manager power on - community.general.redfish_command: - category: Manager - command: PowerOn - resource_id: BMC +- name: Turn manager power on + community.general.redfish_command: + category: Manager + command: PowerOn + resource_id: BMC - - name: Reboot manager power - community.general.redfish_command: - category: Manager - command: PowerReboot - resource_id: BMC +- name: Reboot manager power + community.general.redfish_command: + category: Manager + command: PowerReboot + resource_id: BMC - - name: Factory reset manager to defaults - community.general.redfish_command: - category: Manager - command: ResetToDefaults - resource_id: BMC - reset_to_defaults_mode: ResetAll +- name: Factory reset manager to defaults + community.general.redfish_command: + category: Manager + command: ResetToDefaults + resource_id: BMC + reset_to_defaults_mode: ResetAll - - name: Verify BIOS attributes - community.general.redfish_command: - category: Systems - command: VerifyBiosAttributes - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - bios_attributes: - SubNumaClustering: "Disabled" - WorkloadProfile: "Virtualization-MaxPerformance" -''' +- name: Verify BIOS attributes + community.general.redfish_command: + category: Systems + command: VerifyBiosAttributes + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + bios_attributes: + SubNumaClustering: "Disabled" + WorkloadProfile: "Virtualization-MaxPerformance" +""" -RETURN = ''' +RETURN = r""" msg: - description: Message with action result or error description - returned: always - type: str - sample: "Action was successful" + description: Message with action result or error description. + returned: always + type: str + sample: "Action was successful" return_values: - description: Dictionary containing command-specific response data from the action. - returned: on success - type: dict - version_added: 6.1.0 - sample: { - "update_status": { - "handle": "/redfish/v1/TaskService/TaskMonitors/735", - "messages": [], - "resets_requested": [], - "ret": true, - "status": "New" - } + description: Dictionary containing command-specific response data from the action. + returned: on success + type: dict + version_added: 6.1.0 + sample: { + "update_status": { + "handle": "/redfish/v1/TaskService/TaskMonitors/735", + "messages": [], + "resets_requested": [], + "ret": true, + "status": "New" } -''' + } +""" from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.general.plugins.module_utils.redfish_utils import RedfishUtils diff --git a/plugins/modules/redfish_config.py b/plugins/modules/redfish_config.py index 5b9caecc64..e47597f73f 100644 --- a/plugins/modules/redfish_config.py +++ b/plugins/modules/redfish_config.py @@ -8,13 +8,11 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -DOCUMENTATION = ''' ---- +DOCUMENTATION = r""" module: redfish_config short_description: Manages Out-Of-Band controllers using Redfish APIs description: - - Builds Redfish URIs locally and sends them to remote OOB controllers to - set or update a configuration attribute. + - Builds Redfish URIs locally and sends them to remote OOB controllers to set or update a configuration attribute. - Manages BIOS configuration settings. - Manages OOB controller configuration settings. extends_documentation_fragment: @@ -64,8 +62,7 @@ options: timeout: description: - Timeout in seconds for HTTP requests to OOB controller. - - The default value for this parameter changed from V(10) to V(60) - in community.general 9.0.0. + - The default value for this parameter changed from V(10) to V(60) in community.general 9.0.0. type: int default: 60 boot_order: @@ -111,10 +108,8 @@ options: version_added: '0.2.0' strip_etag_quotes: description: - - Removes surrounding quotes of etag used in C(If-Match) header - of C(PATCH) requests. - - Only use this option to resolve bad vendor implementation where - C(If-Match) only matches the unquoted etag string. + - Removes surrounding quotes of etag used in C(If-Match) header of C(PATCH) requests. + - Only use this option to resolve bad vendor implementation where C(If-Match) only matches the unquoted etag string. type: bool default: false version_added: 3.7.0 @@ -165,15 +160,14 @@ options: description: - Setting parameter to enable or disable SecureBoot. type: bool - default: True + default: true version_added: '7.5.0' volume_details: required: false description: - Setting dict of volume to be created. - - If C(CapacityBytes) key is not specified in this dictionary, the size of - the volume will be determined by the Redfish service. It is possible the - size will not be the maximum available size. + - If C(CapacityBytes) key is not specified in this dictionary, the size of the volume will be determined by the Redfish service. It is possible + the size will not be the maximum available size. type: dict default: {} version_added: '7.5.0' @@ -181,9 +175,8 @@ options: required: false description: - SSL/TLS Ciphers to use for the request. - - 'When a list is provided, all ciphers are joined in order with V(:).' - - See the L(OpenSSL Cipher List Format,https://www.openssl.org/docs/manmaster/man1/openssl-ciphers.html#CIPHER-LIST-FORMAT) - for more details. + - When a list is provided, all ciphers are joined in order with V(:). + - See the L(OpenSSL Cipher List Format,https://www.openssl.org/docs/manmaster/man1/openssl-ciphers.html#CIPHER-LIST-FORMAT) for more details. - The available ciphers is dependent on the Python and OpenSSL/LibreSSL versions. type: list elements: str @@ -192,195 +185,195 @@ options: author: - "Jose Delarosa (@jose-delarosa)" - "T S Kushal (@TSKushal)" -''' +""" -EXAMPLES = ''' - - name: Set BootMode to UEFI - community.general.redfish_config: - category: Systems - command: SetBiosAttributes - resource_id: 437XR1138R2 - bios_attributes: - BootMode: "Uefi" - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +EXAMPLES = r""" +- name: Set BootMode to UEFI + community.general.redfish_config: + category: Systems + command: SetBiosAttributes + resource_id: 437XR1138R2 + bios_attributes: + BootMode: "Uefi" + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Set multiple BootMode attributes - community.general.redfish_config: - category: Systems - command: SetBiosAttributes - resource_id: 437XR1138R2 - bios_attributes: - BootMode: "Bios" - OneTimeBootMode: "Enabled" - BootSeqRetry: "Enabled" - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Set multiple BootMode attributes + community.general.redfish_config: + category: Systems + command: SetBiosAttributes + resource_id: 437XR1138R2 + bios_attributes: + BootMode: "Bios" + OneTimeBootMode: "Enabled" + BootSeqRetry: "Enabled" + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Enable PXE Boot for NIC1 - community.general.redfish_config: - category: Systems - command: SetBiosAttributes - resource_id: 437XR1138R2 - bios_attributes: - PxeDev1EnDis: Enabled - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Enable PXE Boot for NIC1 + community.general.redfish_config: + category: Systems + command: SetBiosAttributes + resource_id: 437XR1138R2 + bios_attributes: + PxeDev1EnDis: Enabled + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Set BIOS default settings with a timeout of 20 seconds - community.general.redfish_config: - category: Systems - command: SetBiosDefaultSettings - resource_id: 437XR1138R2 - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - timeout: 20 +- name: Set BIOS default settings with a timeout of 20 seconds + community.general.redfish_config: + category: Systems + command: SetBiosDefaultSettings + resource_id: 437XR1138R2 + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + timeout: 20 - - name: Set boot order - community.general.redfish_config: - category: Systems - command: SetBootOrder - boot_order: - - Boot0002 - - Boot0001 - - Boot0000 - - Boot0003 - - Boot0004 - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Set boot order + community.general.redfish_config: + category: Systems + command: SetBootOrder + boot_order: + - Boot0002 + - Boot0001 + - Boot0000 + - Boot0003 + - Boot0004 + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Set boot order to the default - community.general.redfish_config: - category: Systems - command: SetDefaultBootOrder - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Set boot order to the default + community.general.redfish_config: + category: Systems + command: SetDefaultBootOrder + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Set Manager Network Protocols - community.general.redfish_config: - category: Manager - command: SetNetworkProtocols - network_protocols: - SNMP: - ProtocolEnabled: true - Port: 161 - HTTP: - ProtocolEnabled: false - Port: 8080 - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Set Manager Network Protocols + community.general.redfish_config: + category: Manager + command: SetNetworkProtocols + network_protocols: + SNMP: + ProtocolEnabled: true + Port: 161 + HTTP: + ProtocolEnabled: false + Port: 8080 + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Set Manager NIC - community.general.redfish_config: - category: Manager - command: SetManagerNic - nic_config: - DHCPv4: - DHCPEnabled: false - IPv4StaticAddresses: - Address: 192.168.1.3 - Gateway: 192.168.1.1 - SubnetMask: 255.255.255.0 - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Set Manager NIC + community.general.redfish_config: + category: Manager + command: SetManagerNic + nic_config: + DHCPv4: + DHCPEnabled: false + IPv4StaticAddresses: + Address: 192.168.1.3 + Gateway: 192.168.1.1 + SubnetMask: 255.255.255.0 + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Disable Host Interface - community.general.redfish_config: - category: Manager - command: SetHostInterface - hostinterface_config: - InterfaceEnabled: false - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Disable Host Interface + community.general.redfish_config: + category: Manager + command: SetHostInterface + hostinterface_config: + InterfaceEnabled: false + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Enable Host Interface for HostInterface resource ID '2' - community.general.redfish_config: - category: Manager - command: SetHostInterface - hostinterface_config: - InterfaceEnabled: true - hostinterface_id: "2" - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Enable Host Interface for HostInterface resource ID '2' + community.general.redfish_config: + category: Manager + command: SetHostInterface + hostinterface_config: + InterfaceEnabled: true + hostinterface_id: "2" + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Set SessionService Session Timeout to 30 minutes - community.general.redfish_config: - category: Sessions - command: SetSessionService - sessions_config: - SessionTimeout: 1800 - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Set SessionService Session Timeout to 30 minutes + community.general.redfish_config: + category: Sessions + command: SetSessionService + sessions_config: + SessionTimeout: 1800 + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Enable SecureBoot - community.general.redfish_config: - category: Systems - command: EnableSecureBoot - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Enable SecureBoot + community.general.redfish_config: + category: Systems + command: EnableSecureBoot + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Set SecureBoot - community.general.redfish_config: - category: Systems - command: SetSecureBoot - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - secure_boot_enable: True +- name: Set SecureBoot + community.general.redfish_config: + category: Systems + command: SetSecureBoot + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + secure_boot_enable: true - - name: Delete All Volumes - community.general.redfish_config: - category: Systems - command: DeleteVolumes - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - storage_subsystem_id: "DExxxxxx" - volume_ids: ["volume1", "volume2"] +- name: Delete All Volumes + community.general.redfish_config: + category: Systems + command: DeleteVolumes + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + storage_subsystem_id: "DExxxxxx" + volume_ids: ["volume1", "volume2"] - - name: Create Volume - community.general.redfish_config: - category: Systems - command: CreateVolume - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - storage_subsystem_id: "DExxxxxx" - volume_details: - Name: "MR Volume" - RAIDType: "RAID0" - Drives: - - "/redfish/v1/Systems/1/Storage/DE00B000/Drives/1" +- name: Create Volume + community.general.redfish_config: + category: Systems + command: CreateVolume + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + storage_subsystem_id: "DExxxxxx" + volume_details: + Name: "MR Volume" + RAIDType: "RAID0" + Drives: + - "/redfish/v1/Systems/1/Storage/DE00B000/Drives/1" - - name: Set service identification to {{ service_id }} - community.general.redfish_config: - category: Manager - command: SetServiceIdentification - service_id: "{{ service_id }}" - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" -''' +- name: Set service identification to {{ service_id }} + community.general.redfish_config: + category: Manager + command: SetServiceIdentification + service_id: "{{ service_id }}" + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" +""" -RETURN = ''' +RETURN = r""" msg: - description: Message with action result or error description - returned: always - type: str - sample: "Action was successful" -''' + description: Message with action result or error description. + returned: always + type: str + sample: "Action was successful" +""" from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.general.plugins.module_utils.redfish_utils import RedfishUtils diff --git a/plugins/modules/redfish_info.py b/plugins/modules/redfish_info.py index b1b4a45ee5..e4e909ad48 100644 --- a/plugins/modules/redfish_info.py +++ b/plugins/modules/redfish_info.py @@ -8,13 +8,11 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -DOCUMENTATION = ''' ---- +DOCUMENTATION = r""" module: redfish_info short_description: Manages Out-Of-Band controllers using Redfish APIs description: - - Builds Redfish URIs locally and sends them to remote OOB controllers to - get information back. + - Builds Redfish URIs locally and sends them to remote OOB controllers to get information back. - Information retrieved is placed in a location specified by the user. extends_documentation_fragment: - community.general.attributes @@ -63,8 +61,7 @@ options: timeout: description: - Timeout in seconds for HTTP requests to OOB controller. - - The default value for this parameter changed from V(10) to V(60) - in community.general 9.0.0. + - The default value for this parameter changed from V(10) to V(60) in community.general 9.0.0. type: int default: 60 update_handle: @@ -77,318 +74,317 @@ options: required: false description: - SSL/TLS Ciphers to use for the request. - - 'When a list is provided, all ciphers are joined in order with V(:).' - - See the L(OpenSSL Cipher List Format,https://www.openssl.org/docs/manmaster/man1/openssl-ciphers.html#CIPHER-LIST-FORMAT) - for more details. + - When a list is provided, all ciphers are joined in order with V(:). + - See the L(OpenSSL Cipher List Format,https://www.openssl.org/docs/manmaster/man1/openssl-ciphers.html#CIPHER-LIST-FORMAT) for more details. - The available ciphers is dependent on the Python and OpenSSL/LibreSSL versions. type: list elements: str version_added: 9.2.0 author: "Jose Delarosa (@jose-delarosa)" -''' +""" -EXAMPLES = ''' - - name: Get CPU inventory - community.general.redfish_info: - category: Systems - command: GetCpuInventory - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - register: result +EXAMPLES = r""" +- name: Get CPU inventory + community.general.redfish_info: + category: Systems + command: GetCpuInventory + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + register: result - - name: Print fetched information - ansible.builtin.debug: - msg: "{{ result.redfish_facts.cpu.entries | to_nice_json }}" +- name: Print fetched information + ansible.builtin.debug: + msg: "{{ result.redfish_facts.cpu.entries | to_nice_json }}" - - name: Get CPU model - community.general.redfish_info: - category: Systems - command: GetCpuInventory - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - register: result +- name: Get CPU model + community.general.redfish_info: + category: Systems + command: GetCpuInventory + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + register: result - - name: Print fetched information - ansible.builtin.debug: - msg: "{{ result.redfish_facts.cpu.entries.0.Model }}" +- name: Print fetched information + ansible.builtin.debug: + msg: "{{ result.redfish_facts.cpu.entries.0.Model }}" - - name: Get memory inventory - community.general.redfish_info: - category: Systems - command: GetMemoryInventory - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - register: result +- name: Get memory inventory + community.general.redfish_info: + category: Systems + command: GetMemoryInventory + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + register: result - - name: Get fan inventory with a timeout of 20 seconds - community.general.redfish_info: - category: Chassis - command: GetFanInventory - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - timeout: 20 - register: result +- name: Get fan inventory with a timeout of 20 seconds + community.general.redfish_info: + category: Chassis + command: GetFanInventory + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + timeout: 20 + register: result - - name: Get Virtual Media information - community.general.redfish_info: - category: Manager - command: GetVirtualMedia - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - register: result +- name: Get Virtual Media information + community.general.redfish_info: + category: Manager + command: GetVirtualMedia + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + register: result - - name: Print fetched information - ansible.builtin.debug: - msg: "{{ result.redfish_facts.virtual_media.entries | to_nice_json }}" +- name: Print fetched information + ansible.builtin.debug: + msg: "{{ result.redfish_facts.virtual_media.entries | to_nice_json }}" - - name: Get Virtual Media information from Systems - community.general.redfish_info: - category: Systems - command: GetVirtualMedia - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - register: result +- name: Get Virtual Media information from Systems + community.general.redfish_info: + category: Systems + command: GetVirtualMedia + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + register: result - - name: Print fetched information - ansible.builtin.debug: - msg: "{{ result.redfish_facts.virtual_media.entries | to_nice_json }}" +- name: Print fetched information + ansible.builtin.debug: + msg: "{{ result.redfish_facts.virtual_media.entries | to_nice_json }}" - - name: Get Volume Inventory - community.general.redfish_info: - category: Systems - command: GetVolumeInventory - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - register: result - - name: Print fetched information - ansible.builtin.debug: - msg: "{{ result.redfish_facts.volume.entries | to_nice_json }}" +- name: Get Volume Inventory + community.general.redfish_info: + category: Systems + command: GetVolumeInventory + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + register: result +- name: Print fetched information + ansible.builtin.debug: + msg: "{{ result.redfish_facts.volume.entries | to_nice_json }}" - - name: Get Session information - community.general.redfish_info: - category: Sessions - command: GetSessions - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - register: result +- name: Get Session information + community.general.redfish_info: + category: Sessions + command: GetSessions + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + register: result - - name: Print fetched information - ansible.builtin.debug: - msg: "{{ result.redfish_facts.session.entries | to_nice_json }}" +- name: Print fetched information + ansible.builtin.debug: + msg: "{{ result.redfish_facts.session.entries | to_nice_json }}" - - name: Get default inventory information - community.general.redfish_info: - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - register: result - - name: Print fetched information - ansible.builtin.debug: - msg: "{{ result.redfish_facts | to_nice_json }}" +- name: Get default inventory information + community.general.redfish_info: + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + register: result +- name: Print fetched information + ansible.builtin.debug: + msg: "{{ result.redfish_facts | to_nice_json }}" - - name: Get several inventories - community.general.redfish_info: - category: Systems - command: GetNicInventory,GetBiosAttributes - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Get several inventories + community.general.redfish_info: + category: Systems + command: GetNicInventory,GetBiosAttributes + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Get default system inventory and user information - community.general.redfish_info: - category: Systems,Accounts - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Get default system inventory and user information + community.general.redfish_info: + category: Systems,Accounts + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Get default system, user and firmware information - community.general.redfish_info: - category: ["Systems", "Accounts", "Update"] - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Get default system, user and firmware information + community.general.redfish_info: + category: ["Systems", "Accounts", "Update"] + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Get Manager NIC inventory information - community.general.redfish_info: - category: Manager - command: GetManagerNicInventory - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Get Manager NIC inventory information + community.general.redfish_info: + category: Manager + command: GetManagerNicInventory + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Get boot override information - community.general.redfish_info: - category: Systems - command: GetBootOverride - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Get boot override information + community.general.redfish_info: + category: Systems + command: GetBootOverride + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Get chassis inventory - community.general.redfish_info: - category: Chassis - command: GetChassisInventory - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Get chassis inventory + community.general.redfish_info: + category: Chassis + command: GetChassisInventory + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Get all information available in the Manager category - community.general.redfish_info: - category: Manager - command: all - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Get all information available in the Manager category + community.general.redfish_info: + category: Manager + command: all + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Get firmware update capability information - community.general.redfish_info: - category: Update - command: GetFirmwareUpdateCapabilities - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Get firmware update capability information + community.general.redfish_info: + category: Update + command: GetFirmwareUpdateCapabilities + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Get firmware inventory - community.general.redfish_info: - category: Update - command: GetFirmwareInventory - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Get firmware inventory + community.general.redfish_info: + category: Update + command: GetFirmwareInventory + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Get service identification - community.general.redfish_info: - category: Manager - command: GetServiceIdentification - manager: "{{ manager }}" - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Get service identification + community.general.redfish_info: + category: Manager + command: GetServiceIdentification + manager: "{{ manager }}" + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Get software inventory - community.general.redfish_info: - category: Update - command: GetSoftwareInventory - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Get software inventory + community.general.redfish_info: + category: Update + command: GetSoftwareInventory + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Get the status of an update operation - community.general.redfish_info: - category: Update - command: GetUpdateStatus - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - update_handle: /redfish/v1/TaskService/TaskMonitors/735 +- name: Get the status of an update operation + community.general.redfish_info: + category: Update + command: GetUpdateStatus + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + update_handle: /redfish/v1/TaskService/TaskMonitors/735 - - name: Get Manager Services - community.general.redfish_info: - category: Manager - command: GetNetworkProtocols - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Get Manager Services + community.general.redfish_info: + category: Manager + command: GetNetworkProtocols + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Get all information available in all categories - community.general.redfish_info: - category: all - command: all - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Get all information available in all categories + community.general.redfish_info: + category: all + command: all + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Get system health report - community.general.redfish_info: - category: Systems - command: GetHealthReport - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Get system health report + community.general.redfish_info: + category: Systems + command: GetHealthReport + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Get chassis health report - community.general.redfish_info: - category: Chassis - command: GetHealthReport - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Get chassis health report + community.general.redfish_info: + category: Chassis + command: GetHealthReport + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Get manager health report - community.general.redfish_info: - category: Manager - command: GetHealthReport - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Get manager health report + community.general.redfish_info: + category: Manager + command: GetHealthReport + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Get manager Redfish Host Interface inventory - community.general.redfish_info: - category: Manager - command: GetHostInterfaces - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Get manager Redfish Host Interface inventory + community.general.redfish_info: + category: Manager + command: GetHostInterfaces + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Get Manager Inventory - community.general.redfish_info: - category: Manager - command: GetManagerInventory - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Get Manager Inventory + community.general.redfish_info: + category: Manager + command: GetManagerInventory + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Get HPE Thermal Config - community.general.redfish_info: - category: Chassis - command: GetHPEThermalConfig - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Get HPE Thermal Config + community.general.redfish_info: + category: Chassis + command: GetHPEThermalConfig + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Get HPE Fan Percent Minimum - community.general.redfish_info: - category: Chassis - command: GetHPEFanPercentMin - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Get HPE Fan Percent Minimum + community.general.redfish_info: + category: Chassis + command: GetHPEFanPercentMin + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Get BIOS registry - community.general.redfish_info: - category: Systems - command: GetBiosRegistries - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Get BIOS registry + community.general.redfish_info: + category: Systems + command: GetBiosRegistries + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" - - name: Check the availability of the service with a timeout of 5 seconds - community.general.redfish_info: - category: Service - command: CheckAvailability - baseuri: "{{ baseuri }}" - username: "{{ username }}" - password: "{{ password }}" - timeout: 5 - register: result -''' +- name: Check the availability of the service with a timeout of 5 seconds + community.general.redfish_info: + category: Service + command: CheckAvailability + baseuri: "{{ baseuri }}" + username: "{{ username }}" + password: "{{ password }}" + timeout: 5 + register: result +""" -RETURN = ''' +RETURN = r""" result: - description: different results depending on task - returned: always - type: dict - sample: List of CPUs on system -''' + description: Different results depending on task. + returned: always + type: dict + sample: List of CPUs on system +""" from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.general.plugins.module_utils.redfish_utils import RedfishUtils diff --git a/plugins/modules/redhat_subscription.py b/plugins/modules/redhat_subscription.py index 338fb92ebd..d9f791e5cf 100644 --- a/plugins/modules/redhat_subscription.py +++ b/plugins/modules/redhat_subscription.py @@ -10,16 +10,15 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -DOCUMENTATION = ''' ---- +DOCUMENTATION = r""" module: redhat_subscription short_description: Manage registration and subscriptions to RHSM using C(subscription-manager) description: - - Manage registration and subscription to the Red Hat Subscription Management entitlement platform using the C(subscription-manager) command, - registering using D-Bus if possible. + - Manage registration and subscription to the Red Hat Subscription Management entitlement platform using the C(subscription-manager) command, + registering using D-Bus if possible. author: "Barnaby Court (@barnabycourt)" notes: - - | + - >- The module tries to use the D-Bus C(rhsm) service (part of C(subscription-manager)) to register, starting from community.general 6.5.0: this is done so credentials (username, password, activation keys) can be passed to C(rhsm) in a secure way. @@ -42,171 +41,161 @@ notes: already registered system, for example attaching pools to it (using O(pool_ids)), and modifying the C(syspurpose) attributes (using O(syspurpose)). requirements: - - subscription-manager - - Optionally the C(dbus) Python library; this is usually included in the OS - as it is used by C(subscription-manager). + - subscription-manager + - Optionally the C(dbus) Python library; this is usually included in the OS as it is used by C(subscription-manager). extends_documentation_fragment: - - community.general.attributes + - community.general.attributes attributes: - check_mode: - support: none - diff_mode: - support: none + check_mode: + support: none + diff_mode: + support: none options: - state: - description: - - whether to register and subscribe (V(present)), or unregister (V(absent)) a system - choices: [ "present", "absent" ] - default: "present" + state: + description: + - Whether to register and subscribe (V(present)), or unregister (V(absent)) a system. + choices: ["present", "absent"] + default: "present" + type: str + username: + description: + - Access.redhat.com or Red Hat Satellite or Katello username. + type: str + password: + description: + - Access.redhat.com or Red Hat Satellite or Katello password. + type: str + token: + description: + - Sso.redhat.com API access token. + type: str + version_added: 6.3.0 + server_hostname: + description: + - Specify an alternative Red Hat Subscription Management or Red Hat Satellite or Katello server. + type: str + server_insecure: + description: + - Enable or disable https server certificate verification when connecting to O(server_hostname). + type: str + server_prefix: + description: + - Specify the prefix when registering to the Red Hat Subscription Management or Red Hat Satellite or Katello server. + type: str + version_added: 3.3.0 + server_port: + description: + - Specify the port when registering to the Red Hat Subscription Management or Red Hat Satellite or Katello server. + type: str + version_added: 3.3.0 + rhsm_baseurl: + description: + - Specify CDN baseurl. + type: str + rhsm_repo_ca_cert: + description: + - Specify an alternative location for a CA certificate for CDN. + type: str + server_proxy_hostname: + description: + - Specify an HTTP proxy hostname. + type: str + server_proxy_scheme: + description: + - Specify an HTTP proxy scheme, for example V(http) or V(https). + type: str + version_added: 6.2.0 + server_proxy_port: + description: + - Specify an HTTP proxy port. + type: str + server_proxy_user: + description: + - Specify a user for HTTP proxy with basic authentication. + type: str + server_proxy_password: + description: + - Specify a password for HTTP proxy with basic authentication. + type: str + auto_attach: + description: + - Upon successful registration, auto-consume available subscriptions. + - "Please note that the alias O(ignore:autosubscribe) was removed in community.general 9.0.0." + type: bool + activationkey: + description: + - Supply an activation key for use with registration. + type: str + org_id: + description: + - Organization ID to use in conjunction with activationkey. + type: str + environment: + description: + - Register with a specific environment in the destination org. Used with Red Hat Satellite or Katello. + type: str + pool_ids: + description: + - "Specify subscription pool IDs to consume. + - A pool ID may be specified as a C(string) - just the pool ID (for example V(0123456789abcdef0123456789abcdef)), + or as a C(dict) with the pool ID as the key, and a quantity as the value (for example V(0123456789abcdef0123456789abcdef: 2). If the + quantity is provided, it is used to consume multiple entitlements from a pool (the pool must support this)." + default: [] + type: list + elements: raw + consumer_type: + description: + - The type of unit to register, defaults to system. + type: str + consumer_name: + description: + - Name of the system to register, defaults to the hostname. + type: str + consumer_id: + description: + - "References an existing consumer ID to resume using a previous registration for this system. If the system's identity certificate is + lost or corrupted, this option allows it to resume using its previous identity and subscriptions. The default is to not specify a consumer + ID so a new ID is created." + type: str + force_register: + description: + - Register the system even if it is already registered. + type: bool + default: false + release: + description: + - Set a release version. + type: str + syspurpose: + description: + - Set syspurpose attributes in file C(/etc/rhsm/syspurpose/syspurpose.json) and synchronize these attributes with RHSM server. Syspurpose + attributes help attach the most appropriate subscriptions to the system automatically. When C(syspurpose.json) file already contains some + attributes, then new attributes overwrite existing attributes. When some attribute is not listed in the new list of attributes, the existing + attribute will be removed from C(syspurpose.json) file. Unknown attributes are ignored. + type: dict + suboptions: + usage: + description: Syspurpose attribute usage. type: str - username: - description: - - access.redhat.com or Red Hat Satellite or Katello username + role: + description: Syspurpose attribute role. type: str - password: - description: - - access.redhat.com or Red Hat Satellite or Katello password + service_level_agreement: + description: Syspurpose attribute service_level_agreement. type: str - token: - description: - - sso.redhat.com API access token. - type: str - version_added: 6.3.0 - server_hostname: - description: - - Specify an alternative Red Hat Subscription Management or Red Hat Satellite or Katello server. - type: str - server_insecure: - description: - - Enable or disable https server certificate verification when connecting to O(server_hostname). - type: str - server_prefix: - description: - - Specify the prefix when registering to the Red Hat Subscription Management or Red Hat Satellite or Katello server. - type: str - version_added: 3.3.0 - server_port: - description: - - Specify the port when registering to the Red Hat Subscription Management or Red Hat Satellite or Katello server. - type: str - version_added: 3.3.0 - rhsm_baseurl: - description: - - Specify CDN baseurl - type: str - rhsm_repo_ca_cert: - description: - - Specify an alternative location for a CA certificate for CDN - type: str - server_proxy_hostname: - description: - - Specify an HTTP proxy hostname. - type: str - server_proxy_scheme: - description: - - Specify an HTTP proxy scheme, for example V(http) or V(https). - type: str - version_added: 6.2.0 - server_proxy_port: - description: - - Specify an HTTP proxy port. - type: str - server_proxy_user: - description: - - Specify a user for HTTP proxy with basic authentication - type: str - server_proxy_password: - description: - - Specify a password for HTTP proxy with basic authentication - type: str - auto_attach: - description: - - Upon successful registration, auto-consume available subscriptions - - | - Please note that the alias O(ignore:autosubscribe) was removed in - community.general 9.0.0. - type: bool - activationkey: - description: - - supply an activation key for use with registration - type: str - org_id: - description: - - Organization ID to use in conjunction with activationkey - type: str - environment: - description: - - Register with a specific environment in the destination org. Used with Red Hat Satellite or Katello - type: str - pool_ids: - description: - - | - Specify subscription pool IDs to consume. - A pool ID may be specified as a C(string) - just the pool ID (for example V(0123456789abcdef0123456789abcdef)), - or as a C(dict) with the pool ID as the key, and a quantity as the value (for example - V(0123456789abcdef0123456789abcdef: 2). If the quantity is provided, it is used to consume multiple - entitlements from a pool (the pool must support this). - default: [] + addons: + description: Syspurpose attribute addons. type: list - elements: raw - consumer_type: + elements: str + sync: description: - - The type of unit to register, defaults to system - type: str - consumer_name: - description: - - Name of the system to register, defaults to the hostname - type: str - consumer_id: - description: - - | - References an existing consumer ID to resume using a previous registration - for this system. If the system's identity certificate is lost or corrupted, - this option allows it to resume using its previous identity and subscriptions. - The default is to not specify a consumer ID so a new ID is created. - type: str - force_register: - description: - - Register the system even if it is already registered + - When this option is V(true), then syspurpose attributes are synchronized with RHSM server immediately. When this option is V(false), + then syspurpose attributes will be synchronized with RHSM server by rhsmcertd daemon. type: bool default: false - release: - description: - - Set a release version - type: str - syspurpose: - description: - - Set syspurpose attributes in file C(/etc/rhsm/syspurpose/syspurpose.json) - and synchronize these attributes with RHSM server. Syspurpose attributes help attach - the most appropriate subscriptions to the system automatically. When C(syspurpose.json) file - already contains some attributes, then new attributes overwrite existing attributes. - When some attribute is not listed in the new list of attributes, the existing - attribute will be removed from C(syspurpose.json) file. Unknown attributes are ignored. - type: dict - suboptions: - usage: - description: Syspurpose attribute usage - type: str - role: - description: Syspurpose attribute role - type: str - service_level_agreement: - description: Syspurpose attribute service_level_agreement - type: str - addons: - description: Syspurpose attribute addons - type: list - elements: str - sync: - description: - - When this option is V(true), then syspurpose attributes are synchronized with - RHSM server immediately. When this option is V(false), then syspurpose attributes - will be synchronized with RHSM server by rhsmcertd daemon. - type: bool - default: false -''' +""" -EXAMPLES = ''' +EXAMPLES = r""" - name: Register as user (joe_user) with password (somepass) and auto-subscribe to available content. community.general.redhat_subscription: state: present @@ -275,17 +264,15 @@ EXAMPLES = ''' - addon1 - addon2 sync: true -''' +""" -RETURN = ''' +RETURN = r""" subscribed_pool_ids: - description: List of pool IDs to which system is now subscribed - returned: success - type: dict - sample: { - "8a85f9815ab905d3015ab928c7005de4": "1" - } -''' + description: List of pool IDs to which system is now subscribed. + returned: success + type: dict + sample: {"8a85f9815ab905d3015ab928c7005de4": "1"} +""" from os.path import isfile from os import getuid, unlink diff --git a/plugins/modules/redis.py b/plugins/modules/redis.py index a30b89922c..716f5f1851 100644 --- a/plugins/modules/redis.py +++ b/plugins/modules/redis.py @@ -8,91 +8,85 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -DOCUMENTATION = ''' ---- +DOCUMENTATION = r""" module: redis short_description: Various redis commands, replica and flush description: - - Unified utility to interact with redis instances. + - Unified utility to interact with redis instances. extends_documentation_fragment: - - community.general.redis - - community.general.attributes + - community.general.redis + - community.general.attributes attributes: - check_mode: - support: full - diff_mode: - support: none + check_mode: + support: full + diff_mode: + support: none options: - command: - description: - - The selected redis command - - V(config) ensures a configuration setting on an instance. - - V(flush) flushes all the instance or a specified db. - - V(replica) sets a redis instance in replica or master mode. (V(slave) is an alias for V(replica).) - choices: [ config, flush, replica, slave ] - type: str - tls: - default: false - version_added: 4.6.0 - login_user: - version_added: 4.6.0 - validate_certs: - version_added: 4.6.0 - ca_certs: - version_added: 4.6.0 - master_host: - description: - - The host of the master instance [replica command] - type: str - master_port: - description: - - The port of the master instance [replica command] - type: int - replica_mode: - description: - - The mode of the redis instance [replica command] - - V(slave) is an alias for V(replica). - default: replica - choices: [ master, replica, slave ] - type: str - aliases: - - slave_mode - db: - description: - - The database to flush (used in db mode) [flush command] - type: int - flush_mode: - description: - - Type of flush (all the dbs in a redis instance or a specific one) - [flush command] - default: all - choices: [ all, db ] - type: str - name: - description: - - A redis config key. - type: str - value: - description: - - A redis config value. When memory size is needed, it is possible - to specify it in the usual form of 1KB, 2M, 400MB where the base is 1024. - Units are case insensitive i.e. 1m = 1mb = 1M = 1MB. - type: str + command: + description: + - The selected redis command. + - V(config) ensures a configuration setting on an instance. + - V(flush) flushes all the instance or a specified db. + - V(replica) sets a redis instance in replica or master mode. (V(slave) is an alias for V(replica)). + choices: [config, flush, replica, slave] + type: str + tls: + default: false + version_added: 4.6.0 + login_user: + version_added: 4.6.0 + validate_certs: + version_added: 4.6.0 + ca_certs: + version_added: 4.6.0 + master_host: + description: + - The host of the master instance [replica command]. + type: str + master_port: + description: + - The port of the master instance [replica command]. + type: int + replica_mode: + description: + - The mode of the redis instance [replica command]. + - V(slave) is an alias for V(replica). + default: replica + choices: [master, replica, slave] + type: str + aliases: + - slave_mode + db: + description: + - The database to flush (used in DB mode) [flush command]. + type: int + flush_mode: + description: + - Type of flush (all the DBs in a redis instance or a specific one) [flush command]. + default: all + choices: [all, db] + type: str + name: + description: + - A redis config key. + type: str + value: + description: + - A redis config value. When memory size is needed, it is possible to specify it in the usual form of 1KB, 2M, 400MB where the base is 1024. + Units are case insensitive, in other words 1m = 1mb = 1M = 1MB. + type: str notes: - - Requires the redis-py Python package on the remote host. You can - install it with pip (pip install redis) or with a package manager. - https://github.com/andymccurdy/redis-py - - If the redis master instance we are making replica of is password protected - this needs to be in the redis.conf in the masterauth variable - + - Requires the C(redis-py) Python package on the remote host. You can install it with pip + (C(pip install redis)) or with a package manager. U(https://github.com/andymccurdy/redis-py). + - If the redis master instance you are making replica of is password protected this needs to be in the C(redis.conf) in the C(masterauth) variable. seealso: - - module: community.general.redis_info -requirements: [ redis ] + - module: community.general.redis_info +requirements: [redis] author: "Xabier Larrakoetxea (@slok)" -''' +""" -EXAMPLES = ''' +EXAMPLES = r""" - name: Set local redis instance to be a replica of melee.island on port 6377 community.general.redis: command: replica @@ -142,7 +136,7 @@ EXAMPLES = ''' ca_certs: /etc/redis/certs/ca.crt client_cert_file: /etc/redis/certs/redis.crt client_key_file: /etc/redis/certs/redis.key -''' +""" import traceback diff --git a/plugins/modules/redis_data.py b/plugins/modules/redis_data.py index fe5cc07ef9..03ae78dce3 100644 --- a/plugins/modules/redis_data.py +++ b/plugins/modules/redis_data.py @@ -8,71 +8,69 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -DOCUMENTATION = ''' ---- +DOCUMENTATION = r""" module: redis_data short_description: Set key value pairs in Redis version_added: 3.7.0 description: - - Set key value pairs in Redis database. + - Set key value pairs in Redis database. author: "Andreas Botzner (@paginabianca)" attributes: - check_mode: - support: full - diff_mode: - support: none + check_mode: + support: full + diff_mode: + support: none options: - key: - description: - - Database key. - required: true - type: str - value: - description: - - Value that key should be set to. - required: false - type: str - expiration: - description: - - Expiration time in milliseconds. - Setting this flag will always result in a change in the database. - required: false - type: int - non_existing: - description: - - Only set key if it does not already exist. - required: false - type: bool - existing: - description: - - Only set key if it already exists. - required: false - type: bool - keep_ttl: - description: - - Retain the time to live associated with the key. - required: false - type: bool - state: - description: - - State of the key. - default: present - type: str - choices: - - present - - absent + key: + description: + - Database key. + required: true + type: str + value: + description: + - Value that key should be set to. + required: false + type: str + expiration: + description: + - Expiration time in milliseconds. Setting this flag will always result in a change in the database. + required: false + type: int + non_existing: + description: + - Only set key if it does not already exist. + required: false + type: bool + existing: + description: + - Only set key if it already exists. + required: false + type: bool + keep_ttl: + description: + - Retain the time to live associated with the key. + required: false + type: bool + state: + description: + - State of the key. + default: present + type: str + choices: + - present + - absent extends_documentation_fragment: - community.general.redis.documentation - community.general.attributes seealso: - - module: community.general.redis_data_incr - - module: community.general.redis_data_info - - module: community.general.redis -''' + - module: community.general.redis_data_incr + - module: community.general.redis_data_info + - module: community.general.redis +""" -EXAMPLES = ''' +EXAMPLES = r""" - name: Set key foo=bar on localhost with no username community.general.redis_data: login_host: localhost @@ -116,9 +114,9 @@ EXAMPLES = ''' login_password: supersecret key: foo state: absent -''' +""" -RETURN = ''' +RETURN = r""" old_value: description: Value of key before setting. returned: on_success if O(state=present) and key exists in database. @@ -134,7 +132,7 @@ msg: returned: always type: str sample: 'Set key: foo to bar' -''' +""" from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.general.plugins.module_utils.redis import ( diff --git a/plugins/modules/redis_data_incr.py b/plugins/modules/redis_data_incr.py index b359e0cb94..0f0aa92974 100644 --- a/plugins/modules/redis_data_incr.py +++ b/plugins/modules/redis_data_incr.py @@ -8,24 +8,22 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -DOCUMENTATION = ''' ---- +DOCUMENTATION = r""" module: redis_data_incr short_description: Increment keys in Redis version_added: 4.0.0 description: - - Increment integers or float keys in Redis database and get new value. - - Default increment for all keys is 1. For specific increments use the - O(increment_int) and O(increment_float) options. + - Increment integers or float keys in Redis database and get new value. + - Default increment for all keys is V(1). For specific increments use the O(increment_int) and O(increment_float) options. author: "Andreas Botzner (@paginabianca)" attributes: check_mode: support: partial details: - - For C(check_mode) to work, the specified O(login_user) needs permission to - run the C(GET) command on the key, otherwise the module will fail. - - When using C(check_mode) the module will try to calculate the value that - Redis would return. If the key is not present, 0.0 is used as value. + - For C(check_mode) to work, the specified O(login_user) needs permission to run the C(GET) command on the key, otherwise the module will + fail. + - When using C(check_mode) the module will try to calculate the value that Redis would return. If the key is not present, V(0.0) is used as + value. diff_mode: support: none options: @@ -42,8 +40,7 @@ options: increment_float: description: - Float amount to increment the key by. - - This only works with keys that contain float values - in their string representation. + - This only works with keys that contain float values in their string representation. type: float required: false @@ -53,12 +50,12 @@ extends_documentation_fragment: - community.general.attributes seealso: - - module: community.general.redis_data - - module: community.general.redis_data_info - - module: community.general.redis -''' + - module: community.general.redis_data + - module: community.general.redis_data_info + - module: community.general.redis +""" -EXAMPLES = ''' +EXAMPLES = r""" - name: Increment integer key foo on localhost with no username and print new value community.general.redis_data_incr: login_host: localhost @@ -77,11 +74,11 @@ EXAMPLES = ''' login_password: somepass key: foo increment_float: '20.4' -''' +""" -RETURN = ''' +RETURN = r""" value: - description: Incremented value of key + description: Incremented value of key. returned: on success type: float sample: '4039.4' @@ -90,7 +87,7 @@ msg: returned: always type: str sample: 'Incremented key: foo by 20.4 to 65.9' -''' +""" from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.general.plugins.module_utils.redis import ( diff --git a/plugins/modules/redis_data_info.py b/plugins/modules/redis_data_info.py index c0af619057..48be45a92f 100644 --- a/plugins/modules/redis_data_info.py +++ b/plugins/modules/redis_data_info.py @@ -8,8 +8,7 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -DOCUMENTATION = ''' ---- +DOCUMENTATION = r""" module: redis_data_info short_description: Get value of key in Redis database version_added: 3.7.0 @@ -33,9 +32,9 @@ seealso: - module: community.general.redis_data_incr - module: community.general.redis_info - module: community.general.redis -''' +""" -EXAMPLES = ''' +EXAMPLES = r""" - name: Get key foo=bar from loalhost with no username community.general.redis_data_info: login_host: localhost @@ -50,9 +49,9 @@ EXAMPLES = ''' validate_certs: true ssl_ca_certs: /path/to/ca/certs key: foo -''' +""" -RETURN = ''' +RETURN = r""" exists: description: If they key exists in the database. returned: on success @@ -67,7 +66,7 @@ msg: returned: always type: str sample: 'Got key: foo with value: bar' -''' +""" from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.general.plugins.module_utils.redis import ( diff --git a/plugins/modules/redis_info.py b/plugins/modules/redis_info.py index c75abcf212..bc43f9251e 100644 --- a/plugins/modules/redis_info.py +++ b/plugins/modules/redis_info.py @@ -9,17 +9,16 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -DOCUMENTATION = r''' ---- +DOCUMENTATION = r""" module: redis_info short_description: Gather information about Redis servers version_added: '0.2.0' description: -- Gathers information and statistics about Redis servers. + - Gathers information and statistics about Redis servers. extends_documentation_fragment: -- community.general.redis -- community.general.attributes -- community.general.attributes.info_module + - community.general.redis + - community.general.attributes + - community.general.attributes.info_module options: login_user: version_added: 7.5.0 @@ -36,11 +35,11 @@ options: type: bool version_added: 9.1.0 seealso: -- module: community.general.redis + - module: community.general.redis author: "Pavlo Bashynskyi (@levonet)" -''' +""" -EXAMPLES = r''' +EXAMPLES = r""" - name: Get server information community.general.redis_info: register: result @@ -57,9 +56,9 @@ EXAMPLES = r''' - name: Print server cluster information ansible.builtin.debug: var: result.cluster_info -''' +""" -RETURN = r''' +RETURN = r""" info: description: The default set of server information sections U(https://redis.io/commands/info). returned: success @@ -211,7 +210,7 @@ cluster: "cluster_stats_messages_received": 1483968, "total_cluster_links_buffer_limit_exceeded": 0 } -''' +""" import traceback diff --git a/plugins/modules/rhevm.py b/plugins/modules/rhevm.py index 7f23009972..4d0a810108 100644 --- a/plugins/modules/rhevm.py +++ b/plugins/modules/rhevm.py @@ -8,151 +8,150 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -DOCUMENTATION = r''' ---- +DOCUMENTATION = r""" module: rhevm short_description: RHEV/oVirt automation description: - - This module only supports oVirt/RHEV version 3. - - A newer module M(ovirt.ovirt.ovirt_vm) supports oVirt/RHV version 4. - - Allows you to create/remove/update or powermanage virtual machines on a RHEV/oVirt platform. + - This module only supports oVirt/RHEV version 3. + - A newer module M(ovirt.ovirt.ovirt_vm) supports oVirt/RHV version 4. + - Allows you to create/remove/update or powermanage virtual machines on a RHEV/oVirt platform. requirements: - - ovirtsdk + - ovirtsdk author: - - Timothy Vandenbrande (@TimothyVandenbrande) + - Timothy Vandenbrande (@TimothyVandenbrande) extends_documentation_fragment: - - community.general.attributes + - community.general.attributes attributes: - check_mode: - support: none - diff_mode: - support: none + check_mode: + support: none + diff_mode: + support: none options: - user: - description: - - The user to authenticate with. - type: str - default: admin@internal - password: - description: - - The password for user authentication. - type: str - required: true - server: - description: - - The name/IP of your RHEV-m/oVirt instance. - type: str - default: 127.0.0.1 - port: - description: - - The port on which the API is reachable. - type: int - default: 443 - insecure_api: - description: - - A boolean switch to make a secure or insecure connection to the server. - type: bool - default: false - name: - description: - - The name of the VM. - type: str - cluster: - description: - - The RHEV/oVirt cluster in which you want you VM to start. - type: str - default: '' - datacenter: - description: - - The RHEV/oVirt datacenter in which you want you VM to start. - type: str - default: Default - state: - description: - - This serves to create/remove/update or powermanage your VM. - type: str - choices: [ absent, cd, down, info, ping, present, restarted, up ] - default: present - image: - description: - - The template to use for the VM. - type: str - type: - description: - - To define if the VM is a server or desktop. - type: str - choices: [ desktop, host, server ] - default: server - vmhost: - description: - - The host you wish your VM to run on. - type: str - vmcpu: - description: - - The number of CPUs you want in your VM. - type: int - default: 2 - cpu_share: - description: - - This parameter is used to configure the CPU share. - type: int - default: 0 - vmmem: - description: - - The amount of memory you want your VM to use (in GB). - type: int - default: 1 - osver: - description: - - The operating system option in RHEV/oVirt. - type: str - default: rhel_6x64 - mempol: - description: - - The minimum amount of memory you wish to reserve for this system. - type: int - default: 1 - vm_ha: - description: - - To make your VM High Available. - type: bool - default: true - disks: - description: - - This option uses complex arguments and is a list of disks with the options name, size and domain. - type: list - elements: str - ifaces: - description: - - This option uses complex arguments and is a list of interfaces with the options name and vlan. - type: list - elements: str - aliases: [ interfaces, nics ] - boot_order: - description: - - This option uses complex arguments and is a list of items that specify the bootorder. - type: list - elements: str - default: [ hd, network ] - del_prot: - description: - - This option sets the delete protection checkbox. - type: bool - default: true - cd_drive: - description: - - The CD you wish to have mounted on the VM when O(state=cd). - type: str - timeout: - description: - - The timeout you wish to define for power actions. - - When O(state=up). - - When O(state=down). - - When O(state=restarted). - type: int -''' + user: + description: + - The user to authenticate with. + type: str + default: admin@internal + password: + description: + - The password for user authentication. + type: str + required: true + server: + description: + - The name/IP of your RHEV-m/oVirt instance. + type: str + default: 127.0.0.1 + port: + description: + - The port on which the API is reachable. + type: int + default: 443 + insecure_api: + description: + - A boolean switch to make a secure or insecure connection to the server. + type: bool + default: false + name: + description: + - The name of the VM. + type: str + cluster: + description: + - The RHEV/oVirt cluster in which you want you VM to start. + type: str + default: '' + datacenter: + description: + - The RHEV/oVirt datacenter in which you want you VM to start. + type: str + default: Default + state: + description: + - This serves to create/remove/update or powermanage your VM. + type: str + choices: [absent, cd, down, info, ping, present, restarted, up] + default: present + image: + description: + - The template to use for the VM. + type: str + type: + description: + - To define if the VM is a server or desktop. + type: str + choices: [desktop, host, server] + default: server + vmhost: + description: + - The host you wish your VM to run on. + type: str + vmcpu: + description: + - The number of CPUs you want in your VM. + type: int + default: 2 + cpu_share: + description: + - This parameter is used to configure the CPU share. + type: int + default: 0 + vmmem: + description: + - The amount of memory you want your VM to use (in GB). + type: int + default: 1 + osver: + description: + - The operating system option in RHEV/oVirt. + type: str + default: rhel_6x64 + mempol: + description: + - The minimum amount of memory you wish to reserve for this system. + type: int + default: 1 + vm_ha: + description: + - To make your VM High Available. + type: bool + default: true + disks: + description: + - This option uses complex arguments and is a list of disks with the options V(name), V(size), and V(domain). + type: list + elements: str + ifaces: + description: + - This option uses complex arguments and is a list of interfaces with the options V(name) and V(vlan). + type: list + elements: str + aliases: [interfaces, nics] + boot_order: + description: + - This option uses complex arguments and is a list of items that specify the bootorder. + type: list + elements: str + default: [hd, network] + del_prot: + description: + - This option sets the delete protection checkbox. + type: bool + default: true + cd_drive: + description: + - The CD you wish to have mounted on the VM when O(state=cd). + type: str + timeout: + description: + - The timeout you wish to define for power actions. + - When O(state=up). + - When O(state=down). + - When O(state=restarted). + type: int +""" -RETURN = r''' +RETURN = r""" vm: description: Returns all of the VMs variables and execution. returned: always @@ -216,9 +215,9 @@ vm: "vmhost": "host416", "vmmem": "16" } -''' +""" -EXAMPLES = r''' +EXAMPLES = r""" - name: Basic get info from VM community.general.rhevm: server: rhevm01 @@ -258,33 +257,33 @@ EXAMPLES = r''' vmcpu: 4 vmmem: 2 ifaces: - - name: eth0 - vlan: vlan2202 - - name: eth1 - vlan: vlan36 - - name: eth2 - vlan: vlan38 - - name: eth3 - vlan: vlan2202 + - name: eth0 + vlan: vlan2202 + - name: eth1 + vlan: vlan36 + - name: eth2 + vlan: vlan38 + - name: eth3 + vlan: vlan2202 disks: - - name: root - size: 10 - domain: ssd-san - - name: swap - size: 10 - domain: 15kiscsi-san - - name: opt - size: 10 - domain: 15kiscsi-san - - name: var - size: 10 - domain: 10kiscsi-san - - name: home - size: 10 - domain: sata-san + - name: root + size: 10 + domain: ssd-san + - name: swap + size: 10 + domain: 15kiscsi-san + - name: opt + size: 10 + domain: 15kiscsi-san + - name: var + size: 10 + domain: 10kiscsi-san + - name: home + size: 10 + domain: sata-san boot_order: - - network - - hd + - network + - hd state: present - name: Add a CD to the disk cd_drive @@ -302,33 +301,33 @@ EXAMPLES = r''' type: host cluster: rhevm01 ifaces: - - name: em1 - - name: em2 - - name: p3p1 - ip: 172.31.224.200 - netmask: 255.255.254.0 - - name: p3p2 - ip: 172.31.225.200 - netmask: 255.255.254.0 - - name: bond0 - bond: - - em1 - - em2 - network: rhevm - ip: 172.31.222.200 - netmask: 255.255.255.0 - management: true - - name: bond0.36 - network: vlan36 - ip: 10.2.36.200 - netmask: 255.255.254.0 - gateway: 10.2.36.254 - - name: bond0.2202 - network: vlan2202 - - name: bond0.38 - network: vlan38 + - name: em1 + - name: em2 + - name: p3p1 + ip: 172.31.224.200 + netmask: 255.255.254.0 + - name: p3p2 + ip: 172.31.225.200 + netmask: 255.255.254.0 + - name: bond0 + bond: + - em1 + - em2 + network: rhevm + ip: 172.31.222.200 + netmask: 255.255.255.0 + management: true + - name: bond0.36 + network: vlan36 + ip: 10.2.36.200 + netmask: 255.255.254.0 + gateway: 10.2.36.254 + - name: bond0.2202 + network: vlan2202 + - name: bond0.38 + network: vlan38 state: present -''' +""" import time diff --git a/plugins/modules/rhsm_release.py b/plugins/modules/rhsm_release.py index 8c74ca8192..ca3a0d03d9 100644 --- a/plugins/modules/rhsm_release.py +++ b/plugins/modules/rhsm_release.py @@ -8,18 +8,15 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -DOCUMENTATION = ''' ---- +DOCUMENTATION = r""" module: rhsm_release short_description: Set or Unset RHSM Release version description: - Sets or unsets the release version used by RHSM repositories. notes: - - This module will fail on an unregistered system. - Use the M(community.general.redhat_subscription) module to register a system - prior to setting the RHSM release. - - It is possible to interact with C(subscription-manager) only as root, - so root permissions are required to successfully run this module. + - This module will fail on an unregistered system. Use the M(community.general.redhat_subscription) module to register a system prior to setting + the RHSM release. + - It is possible to interact with C(subscription-manager) only as root, so root permissions are required to successfully run this module. requirements: - Red Hat Enterprise Linux 6+ with subscription-manager installed extends_documentation_fragment: @@ -37,9 +34,9 @@ options: type: str author: - Sean Myers (@seandst) -''' +""" -EXAMPLES = ''' +EXAMPLES = r""" # Set release version to 7.1 - name: Set RHSM release version community.general.rhsm_release: @@ -53,15 +50,15 @@ EXAMPLES = ''' # Unset release version - name: Unset RHSM release release community.general.rhsm_release: - release: null -''' + release: +""" -RETURN = ''' +RETURN = r""" current_release: - description: The current RHSM release version value + description: The current RHSM release version value. returned: success type: str -''' +""" from ansible.module_utils.basic import AnsibleModule diff --git a/plugins/modules/rhsm_repository.py b/plugins/modules/rhsm_repository.py index ed8b0e7d58..3e95e69425 100644 --- a/plugins/modules/rhsm_repository.py +++ b/plugins/modules/rhsm_repository.py @@ -8,20 +8,16 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -DOCUMENTATION = ''' ---- +DOCUMENTATION = r""" module: rhsm_repository short_description: Manage RHSM repositories using the subscription-manager command description: - - Manage (Enable/Disable) RHSM repositories to the Red Hat Subscription - Management entitlement platform using the C(subscription-manager) command. + - Manage (Enable/Disable) RHSM repositories to the Red Hat Subscription Management entitlement platform using the C(subscription-manager) command. author: Giovanni Sciortino (@giovannisciortino) notes: - - In order to manage RHSM repositories the system must be already registered - to RHSM manually or using the Ansible M(community.general.redhat_subscription) module. - - It is possible to interact with C(subscription-manager) only as root, - so root permissions are required to successfully run this module. - + - In order to manage RHSM repositories the system must be already registered to RHSM manually or using the Ansible M(community.general.redhat_subscription) + module. + - It is possible to interact with C(subscription-manager) only as root, so root permissions are required to successfully run this module. requirements: - subscription-manager extends_documentation_fragment: @@ -34,31 +30,27 @@ attributes: options: state: description: - - If state is equal to present or disabled, indicates the desired - repository state. - - In community.general 10.0.0 the states V(present) and V(absent) have been - removed. Please use V(enabled) and V(disabled) instead. + - If state is equal to present or disabled, indicates the desired repository state. + - In community.general 10.0.0 the states V(present) and V(absent) have been removed. Please use V(enabled) and V(disabled) instead. choices: [enabled, disabled] default: "enabled" type: str name: description: - The ID of repositories to enable. - - To operate on several repositories this can accept a comma separated - list or a YAML list. + - To operate on several repositories this can accept a comma separated list or a YAML list. required: true type: list elements: str purge: description: - - Disable all currently enabled repositories that are not not specified in O(name). - Only set this to V(true) if passing in a list of repositories to the O(name) field. - Using this with C(loop) will most likely not have the desired result. + - Disable all currently enabled repositories that are not not specified in O(name). Only set this to V(true) if passing in a list of repositories + to the O(name) field. Using this with C(loop) will most likely not have the desired result. type: bool default: false -''' +""" -EXAMPLES = ''' +EXAMPLES = r""" - name: Enable a RHSM repository community.general.rhsm_repository: name: rhel-7-server-rpms @@ -77,16 +69,16 @@ EXAMPLES = ''' community.general.rhsm_repository: name: rhel-7-server-rpms purge: true -''' +""" -RETURN = ''' +RETURN = r""" repositories: description: - The list of RHSM repositories with their states. - When this module is used to change the repository states, this list contains the updated states after the changes. returned: success type: list -''' +""" import os from fnmatch import fnmatch diff --git a/plugins/modules/riak.py b/plugins/modules/riak.py index 438263da22..cd3a3f4e8f 100644 --- a/plugins/modules/riak.py +++ b/plugins/modules/riak.py @@ -9,18 +9,16 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -DOCUMENTATION = ''' ---- +DOCUMENTATION = r""" module: riak short_description: This module handles some common Riak operations description: - - This module can be used to join nodes to a cluster, check - the status of the cluster. + - This module can be used to join nodes to a cluster, check the status of the cluster. author: - - "James Martin (@jsmartin)" - - "Drew Kerrigan (@drewkerrigan)" + - "James Martin (@jsmartin)" + - "Drew Kerrigan (@drewkerrigan)" extends_documentation_fragment: - - community.general.attributes + - community.general.attributes attributes: check_mode: support: none @@ -34,17 +32,17 @@ options: type: str config_dir: description: - - The path to the riak configuration directory + - The path to the riak configuration directory. default: /etc/riak type: path http_conn: description: - - The ip address and port that is listening for Riak HTTP queries + - The ip address and port that is listening for Riak HTTP queries. default: 127.0.0.1:8098 type: str target_node: description: - - The target node for certain operations (join, ping) + - The target node for certain operations (join, ping). default: riak@127.0.0.1 type: str wait_for_handoffs: @@ -64,13 +62,12 @@ options: type: str validate_certs: description: - - If V(false), SSL certificates will not be validated. This should only be used - on personally controlled sites using self-signed certificates. + - If V(false), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. type: bool default: true -''' +""" -EXAMPLES = ''' +EXAMPLES = r""" - name: "Join's a Riak node to another node" community.general.riak: command: join @@ -83,7 +80,7 @@ EXAMPLES = ''' - name: Wait for riak_kv service to startup community.general.riak: wait_for_service: kv -''' +""" import json import time diff --git a/plugins/modules/rocketchat.py b/plugins/modules/rocketchat.py index 473f0150ab..82de3f829f 100644 --- a/plugins/modules/rocketchat.py +++ b/plugins/modules/rocketchat.py @@ -12,11 +12,11 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -DOCUMENTATION = ''' +DOCUMENTATION = r""" module: rocketchat short_description: Send notifications to Rocket Chat description: - - The C(rocketchat) module sends notifications to Rocket Chat via the Incoming WebHook integration + - This module sends notifications to Rocket Chat through the Incoming WebHook integration. author: "Ramon de la Fuente (@ramondelafuente)" extends_documentation_fragment: - community.general.attributes @@ -29,15 +29,12 @@ options: domain: type: str description: - - The domain for your environment without protocol. (For example - V(example.com) or V(chat.example.com).) + - The domain for your environment without protocol. (For example V(example.com) or V(chat.example.com)). required: true token: type: str description: - - Rocket Chat Incoming Webhook integration token. This provides - authentication to Rocket Chat's Incoming webhook for posting - messages. + - Rocket Chat Incoming Webhook integration token. This provides authentication to Rocket Chat's Incoming webhook for posting messages. required: true protocol: type: str @@ -54,8 +51,8 @@ options: channel: type: str description: - - Channel to send the message to. If absent, the message goes to the channel selected for the O(token) - specified during the creation of webhook. + - Channel to send the message to. If absent, the message goes to the channel selected for the O(token) specified during the creation of + webhook. username: type: str description: @@ -69,8 +66,7 @@ options: icon_emoji: type: str description: - - Emoji for the message sender. The representation for the available emojis can be - got from Rocket Chat. + - Emoji for the message sender. The representation for the available emojis can be got from Rocket Chat. - For example V(:thumbsup:). - If O(icon_emoji) is set, O(icon_url) will not be used. link_names: @@ -83,14 +79,13 @@ options: - 0 validate_certs: description: - - If V(false), SSL certificates will not be validated. This should only be used - on personally controlled sites using self-signed certificates. + - If V(false), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. type: bool default: true color: type: str description: - - Allow text to use default colors - use the default of 'normal' to not send a custom color bar at the start of the message + - Allow text to use default colors - use the default of V(normal) to not send a custom color bar at the start of the message. default: 'normal' choices: - 'normal' @@ -102,17 +97,17 @@ options: elements: dict description: - Define a list of attachments. -''' +""" -EXAMPLES = """ -- name: Send notification message via Rocket Chat +EXAMPLES = r""" +- name: Send notification message through Rocket Chat community.general.rocketchat: token: thetoken/generatedby/rocketchat domain: chat.example.com msg: '{{ inventory_hostname }} completed' delegate_to: localhost -- name: Send notification message via Rocket Chat all options +- name: Send notification message through Rocket Chat all options community.general.rocketchat: domain: chat.example.com token: thetoken/generatedby/rocketchat @@ -151,12 +146,12 @@ EXAMPLES = """ delegate_to: localhost """ -RETURN = """ +RETURN = r""" changed: - description: A flag indicating if any change was made or not. - returned: success - type: bool - sample: false + description: A flag indicating if any change was made or not. + returned: success + type: bool + sample: false """ from ansible.module_utils.basic import AnsibleModule diff --git a/plugins/modules/rollbar_deployment.py b/plugins/modules/rollbar_deployment.py index 4bce9ab980..e9bfc239b0 100644 --- a/plugins/modules/rollbar_deployment.py +++ b/plugins/modules/rollbar_deployment.py @@ -9,14 +9,12 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -DOCUMENTATION = ''' ---- +DOCUMENTATION = r""" module: rollbar_deployment author: "Max Riveiro (@kavu)" short_description: Notify Rollbar about app deployments description: - - Notify Rollbar about app deployments - (see https://rollbar.com/docs/deploys_other/) + - Notify Rollbar about app deployments (see U(https://rollbar.com/docs/deploys_other/)). extends_documentation_fragment: - community.general.attributes attributes: @@ -33,7 +31,7 @@ options: environment: type: str description: - - Name of the environment being deployed, e.g. 'production'. + - Name of the environment being deployed, for example V(production). required: true revision: type: str @@ -53,7 +51,7 @@ options: comment: type: str description: - - Deploy comment (e.g. what is being deployed). + - Deploy comment (for example what is being deployed). required: false url: type: str @@ -63,31 +61,30 @@ options: default: 'https://api.rollbar.com/api/1/deploy/' validate_certs: description: - - If V(false), SSL certificates for the target url will not be validated. - This should only be used on personally controlled sites using + - If V(false), SSL certificates for the target url will not be validated. This should only be used on personally controlled sites using self-signed certificates. required: false default: true type: bool -''' +""" -EXAMPLES = ''' - - name: Rollbar deployment notification - community.general.rollbar_deployment: - token: AAAAAA - environment: staging - user: ansible - revision: '4.2' - rollbar_user: admin - comment: Test Deploy +EXAMPLES = r""" +- name: Rollbar deployment notification + community.general.rollbar_deployment: + token: AAAAAA + environment: staging + user: ansible + revision: '4.2' + rollbar_user: admin + comment: Test Deploy - - name: Notify rollbar about current git revision deployment by current user - community.general.rollbar_deployment: - token: "{{ rollbar_access_token }}" - environment: production - revision: "{{ lookup('pipe', 'git rev-parse HEAD') }}" - user: "{{ lookup('env', 'USER') }}" -''' +- name: Notify rollbar about current git revision deployment by current user + community.general.rollbar_deployment: + token: "{{ rollbar_access_token }}" + environment: production + revision: "{{ lookup('pipe', 'git rev-parse HEAD') }}" + user: "{{ lookup('env', 'USER') }}" +""" import traceback from ansible.module_utils.basic import AnsibleModule diff --git a/plugins/modules/rpm_ostree_pkg.py b/plugins/modules/rpm_ostree_pkg.py index 8c5c693f60..3d5ba865c9 100644 --- a/plugins/modules/rpm_ostree_pkg.py +++ b/plugins/modules/rpm_ostree_pkg.py @@ -10,50 +10,49 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -DOCUMENTATION = r''' ---- +DOCUMENTATION = r""" module: rpm_ostree_pkg short_description: Install or uninstall overlay additional packages version_added: "2.0.0" description: - - Install or uninstall overlay additional packages using C(rpm-ostree) command. + - Install or uninstall overlay additional packages using C(rpm-ostree) command. extends_documentation_fragment: - - community.general.attributes + - community.general.attributes attributes: - check_mode: - support: none - diff_mode: - support: none + check_mode: + support: none + diff_mode: + support: none options: - name: - description: + name: + description: - Name of overlay package to install or remove. - required: true - type: list - elements: str - aliases: [ pkg ] - state: - description: + required: true + type: list + elements: str + aliases: [pkg] + state: + description: - State of the overlay package. - V(present) simply ensures that a desired package is installed. - V(absent) removes the specified package. - choices: [ 'absent', 'present' ] - default: 'present' - type: str - apply_live: - description: + choices: ['absent', 'present'] + default: 'present' + type: str + apply_live: + description: - Adds the options C(--apply-live) when O(state=present). - Option is ignored when O(state=absent). - For more information, please see U(https://coreos.github.io/rpm-ostree/apply-live/). - type: bool - default: false - version_added: 10.1.0 + type: bool + default: false + version_added: 10.1.0 author: - - Dusty Mabe (@dustymabe) - - Abhijeet Kasurde (@Akasurde) -''' + - Dusty Mabe (@dustymabe) + - Abhijeet Kasurde (@Akasurde) +""" -EXAMPLES = r''' +EXAMPLES = r""" - name: Install overlay package community.general.rpm_ostree_pkg: name: nfs-utils @@ -80,51 +79,51 @@ EXAMPLES = r''' until: rpm_ostree_pkg is not failed retries: 10 dealy: 30 -''' +""" -RETURN = r''' +RETURN = r""" rc: - description: Return code of rpm-ostree command. - returned: always - type: int - sample: 0 + description: Return code of rpm-ostree command. + returned: always + type: int + sample: 0 changed: - description: State changes. - returned: always - type: bool - sample: true + description: State changes. + returned: always + type: bool + sample: true action: - description: Action performed. - returned: always - type: str - sample: 'install' + description: Action performed. + returned: always + type: str + sample: 'install' packages: - description: A list of packages specified. - returned: always - type: list - sample: ['nfs-utils'] + description: A list of packages specified. + returned: always + type: list + sample: ['nfs-utils'] stdout: - description: Stdout of rpm-ostree command. - returned: always - type: str - sample: 'Staging deployment...done\n...' + description: Stdout of rpm-ostree command. + returned: always + type: str + sample: 'Staging deployment...done\n...' stderr: - description: Stderr of rpm-ostree command. - returned: always - type: str - sample: '' + description: Stderr of rpm-ostree command. + returned: always + type: str + sample: '' cmd: - description: Full command used for performed action. - returned: always - type: str - sample: 'rpm-ostree uninstall --allow-inactive --idempotent --unchanged-exit-77 nfs-utils' + description: Full command used for performed action. + returned: always + type: str + sample: 'rpm-ostree uninstall --allow-inactive --idempotent --unchanged-exit-77 nfs-utils' needs_reboot: - description: Determine if machine needs a reboot to apply current changes. - returned: success - type: bool - sample: true - version_added: 10.1.0 -''' + description: Determine if machine needs a reboot to apply current changes. + returned: success + type: bool + sample: true + version_added: 10.1.0 +""" from ansible.module_utils.basic import AnsibleModule diff --git a/plugins/modules/rundeck_acl_policy.py b/plugins/modules/rundeck_acl_policy.py index 8f21a32680..29b31a6642 100644 --- a/plugins/modules/rundeck_acl_policy.py +++ b/plugins/modules/rundeck_acl_policy.py @@ -11,71 +11,70 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -DOCUMENTATION = ''' ---- +DOCUMENTATION = r""" module: rundeck_acl_policy short_description: Manage Rundeck ACL policies description: - - Create, update and remove Rundeck ACL policies through HTTP API. + - Create, update and remove Rundeck ACL policies through HTTP API. author: "Loic Blot (@nerzhul)" attributes: - check_mode: - support: full - diff_mode: - support: none + check_mode: + support: full + diff_mode: + support: none options: - state: - type: str - description: - - Create or remove Rundeck project. - choices: ['present', 'absent'] - default: 'present' - name: - type: str - description: - - Sets the project name. - required: true - api_token: - description: - - Sets the token to authenticate against Rundeck API. - aliases: ["token"] - project: - type: str - description: - - Sets the project which receive the ACL policy. - - If unset, it's a system ACL policy. - policy: - type: str - description: - - Sets the ACL policy content. - - ACL policy content is a YAML object as described in http://rundeck.org/docs/man5/aclpolicy.html. - - It can be a YAML string or a pure Ansible inventory YAML object. - client_cert: - version_added: '0.2.0' - client_key: - version_added: '0.2.0' - force: - version_added: '0.2.0' - force_basic_auth: - version_added: '0.2.0' - http_agent: - version_added: '0.2.0' - url_password: - version_added: '0.2.0' - url_username: - version_added: '0.2.0' - use_proxy: - version_added: '0.2.0' - validate_certs: - version_added: '0.2.0' + state: + type: str + description: + - Create or remove Rundeck project. + choices: ['present', 'absent'] + default: 'present' + name: + type: str + description: + - Sets the project name. + required: true + api_token: + description: + - Sets the token to authenticate against Rundeck API. + aliases: ["token"] + project: + type: str + description: + - Sets the project which receive the ACL policy. + - If unset, it's a system ACL policy. + policy: + type: str + description: + - Sets the ACL policy content. + - ACL policy content is a YAML object as described in U(http://rundeck.org/docs/man5/aclpolicy.html). + - It can be a YAML string or a pure Ansible inventory YAML object. + client_cert: + version_added: '0.2.0' + client_key: + version_added: '0.2.0' + force: + version_added: '0.2.0' + force_basic_auth: + version_added: '0.2.0' + http_agent: + version_added: '0.2.0' + url_password: + version_added: '0.2.0' + url_username: + version_added: '0.2.0' + use_proxy: + version_added: '0.2.0' + validate_certs: + version_added: '0.2.0' extends_documentation_fragment: - ansible.builtin.url - community.general.attributes - community.general.rundeck -''' +""" -EXAMPLES = ''' +EXAMPLES = r""" - name: Create or update a rundeck ACL policy in project Ansible community.general.rundeck_acl_policy: name: "Project_01" @@ -100,22 +99,22 @@ EXAMPLES = ''' url: "https://rundeck.example.org" token: "mytoken" state: absent -''' +""" -RETURN = ''' +RETURN = r""" rundeck_response: - description: Rundeck response when a failure occurs. - returned: failed - type: str + description: Rundeck response when a failure occurs. + returned: failed + type: str before: - description: Dictionary containing ACL policy information before modification. - returned: success - type: dict + description: Dictionary containing ACL policy information before modification. + returned: success + type: dict after: - description: Dictionary containing ACL policy information after modification. - returned: success - type: dict -''' + description: Dictionary containing ACL policy information after modification. + returned: success + type: dict +""" # import module snippets import re diff --git a/plugins/modules/rundeck_job_executions_info.py b/plugins/modules/rundeck_job_executions_info.py index 818bde83c0..540c8c7788 100644 --- a/plugins/modules/rundeck_job_executions_info.py +++ b/plugins/modules/rundeck_job_executions_info.py @@ -9,43 +9,42 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -DOCUMENTATION = ''' ---- +DOCUMENTATION = r""" module: rundeck_job_executions_info short_description: Query executions for a Rundeck job description: - - This module gets the list of executions for a specified Rundeck job. + - This module gets the list of executions for a specified Rundeck job. author: "Phillipe Smith (@phsmith)" version_added: 3.8.0 options: - job_id: - type: str - description: - - The job unique ID. - required: true - status: - type: str - description: - - The job status to filter. - choices: [succeeded, failed, aborted, running] - max: - type: int - description: - - Max results to return. - default: 20 - offset: - type: int - description: - - The start point to return the results. - default: 0 + job_id: + type: str + description: + - The job unique ID. + required: true + status: + type: str + description: + - The job status to filter. + choices: [succeeded, failed, aborted, running] + max: + type: int + description: + - Max results to return. + default: 20 + offset: + type: int + description: + - The start point to return the results. + default: 0 extends_documentation_fragment: - community.general.rundeck - url - community.general.attributes - community.general.attributes.info_module -''' +""" -EXAMPLES = ''' +EXAMPLES = r""" - name: Get Rundeck job executions info community.general.rundeck_job_executions_info: url: "https://rundeck.example.org" @@ -57,36 +56,31 @@ EXAMPLES = ''' - name: Show Rundeck job executions info ansible.builtin.debug: var: rundeck_job_executions_info.executions -''' +""" -RETURN = ''' +RETURN = r""" paging: - description: Results pagination info. - returned: success - type: dict - contains: - count: - description: Number of results in the response. - type: int - returned: success - total: - description: Total number of results. - type: int - returned: success - offset: - description: Offset from first of all results. - type: int - returned: success - max: - description: Maximum number of results per page. - type: int - returned: success - sample: { - "count": 20, - "total": 100, - "offset": 0, - "max": 20 - } + description: Results pagination info. + returned: success + type: dict + contains: + count: + description: Number of results in the response. + type: int + returned: success + total: + description: Total number of results. + type: int + returned: success + offset: + description: Offset from first of all results. + type: int + returned: success + max: + description: Maximum number of results per page. + type: int + returned: success + sample: {"count": 20, "total": 100, "offset": 0, "max": 20} executions: description: Job executions list. returned: always @@ -127,7 +121,7 @@ executions: "serverUUID": "5b9a1438-fa3a-457e-b254-8f3d70338068" } ] -''' +""" from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.six.moves.urllib.parse import quote diff --git a/plugins/modules/rundeck_job_run.py b/plugins/modules/rundeck_job_run.py index 2ef1447401..f46b5ee432 100644 --- a/plugins/modules/rundeck_job_run.py +++ b/plugins/modules/rundeck_job_run.py @@ -9,75 +9,74 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -DOCUMENTATION = ''' ---- +DOCUMENTATION = r""" module: rundeck_job_run short_description: Run a Rundeck job description: - - This module runs a Rundeck job specified by ID. + - This module runs a Rundeck job specified by ID. author: "Phillipe Smith (@phsmith)" version_added: 3.8.0 attributes: - check_mode: - support: none - diff_mode: - support: none + check_mode: + support: none + diff_mode: + support: none options: - job_id: - type: str - description: - - The job unique ID. - required: true - job_options: - type: dict - description: - - The job options for the steps. - - Numeric values must be quoted. - filter_nodes: - type: str - description: - - Filter the nodes where the jobs must run. - - See U(https://docs.rundeck.com/docs/manual/11-node-filters.html#node-filter-syntax). - run_at_time: - type: str - description: - - Schedule the job execution to run at specific date and time. - - ISO-8601 date and time format like V(2021-10-05T15:45:00-03:00). - loglevel: - type: str - description: - - Log level configuration. - choices: [debug, verbose, info, warn, error] - default: info - wait_execution: - type: bool - description: - - Wait until the job finished the execution. - default: true - wait_execution_delay: - type: int - description: - - Delay, in seconds, between job execution status check requests. - default: 5 - wait_execution_timeout: - type: int - description: - - Job execution wait timeout in seconds. - - If the timeout is reached, the job will be aborted. - - Keep in mind that there is a sleep based on O(wait_execution_delay) after each job status check. - default: 120 - abort_on_timeout: - type: bool - description: - - Send a job abort request if exceeded the O(wait_execution_timeout) specified. - default: false + job_id: + type: str + description: + - The job unique ID. + required: true + job_options: + type: dict + description: + - The job options for the steps. + - Numeric values must be quoted. + filter_nodes: + type: str + description: + - Filter the nodes where the jobs must run. + - See U(https://docs.rundeck.com/docs/manual/11-node-filters.html#node-filter-syntax). + run_at_time: + type: str + description: + - Schedule the job execution to run at specific date and time. + - ISO-8601 date and time format like V(2021-10-05T15:45:00-03:00). + loglevel: + type: str + description: + - Log level configuration. + choices: [debug, verbose, info, warn, error] + default: info + wait_execution: + type: bool + description: + - Wait until the job finished the execution. + default: true + wait_execution_delay: + type: int + description: + - Delay, in seconds, between job execution status check requests. + default: 5 + wait_execution_timeout: + type: int + description: + - Job execution wait timeout in seconds. + - If the timeout is reached, the job will be aborted. + - Keep in mind that there is a sleep based on O(wait_execution_delay) after each job status check. + default: 120 + abort_on_timeout: + type: bool + description: + - Send a job abort request if exceeded the O(wait_execution_timeout) specified. + default: false extends_documentation_fragment: - community.general.rundeck - ansible.builtin.url - community.general.attributes -''' +""" -EXAMPLES = ''' +EXAMPLES = r""" - name: Run a Rundeck job community.general.rundeck_job_run: url: "https://rundeck.example.org" @@ -97,9 +96,9 @@ EXAMPLES = ''' api_token: "mytoken" job_id: "xxxxxxxxxxxxxxxxx" job_options: - option_1: "value_1" - option_2: "value_3" - option_3: "value_3" + option_1: "value_1" + option_2: "value_3" + option_3: "value_3" register: rundeck_job_run - name: Run a Rundeck job with timeout, delay between status check and abort on timeout @@ -130,9 +129,9 @@ EXAMPLES = ''' job_id: "xxxxxxxxxxxxxxxxx" wait_execution: false register: rundeck_job_run -''' +""" -RETURN = ''' +RETURN = r""" execution_info: description: Rundeck job execution metadata. returned: always @@ -177,7 +176,7 @@ execution_info: "output": "Test!" } } -''' +""" # Modules import from datetime import datetime, timedelta diff --git a/plugins/modules/rundeck_project.py b/plugins/modules/rundeck_project.py index 79ca575684..0cb6010346 100644 --- a/plugins/modules/rundeck_project.py +++ b/plugins/modules/rundeck_project.py @@ -13,60 +13,59 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -DOCUMENTATION = ''' ---- +DOCUMENTATION = r""" module: rundeck_project short_description: Manage Rundeck projects description: - - Create and remove Rundeck projects through HTTP API. + - Create and remove Rundeck projects through HTTP API. author: "Loic Blot (@nerzhul)" attributes: - check_mode: - support: full - diff_mode: - support: none + check_mode: + support: full + diff_mode: + support: none options: - state: - type: str - description: - - Create or remove Rundeck project. - choices: ['present', 'absent'] - default: 'present' - name: - type: str - description: - - Sets the project name. - required: true - api_token: - description: - - Sets the token to authenticate against Rundeck API. - aliases: ["token"] - client_cert: - version_added: '0.2.0' - client_key: - version_added: '0.2.0' - force: - version_added: '0.2.0' - force_basic_auth: - version_added: '0.2.0' - http_agent: - version_added: '0.2.0' - url_password: - version_added: '0.2.0' - url_username: - version_added: '0.2.0' - use_proxy: - version_added: '0.2.0' - validate_certs: - version_added: '0.2.0' + state: + type: str + description: + - Create or remove Rundeck project. + choices: ['present', 'absent'] + default: 'present' + name: + type: str + description: + - Sets the project name. + required: true + api_token: + description: + - Sets the token to authenticate against Rundeck API. + aliases: ["token"] + client_cert: + version_added: '0.2.0' + client_key: + version_added: '0.2.0' + force: + version_added: '0.2.0' + force_basic_auth: + version_added: '0.2.0' + http_agent: + version_added: '0.2.0' + url_password: + version_added: '0.2.0' + url_username: + version_added: '0.2.0' + use_proxy: + version_added: '0.2.0' + validate_certs: + version_added: '0.2.0' extends_documentation_fragment: - ansible.builtin.url - community.general.attributes - community.general.rundeck -''' +""" -EXAMPLES = ''' +EXAMPLES = r""" - name: Create a rundeck project community.general.rundeck_project: name: "Project_01" @@ -83,22 +82,22 @@ EXAMPLES = ''' url: "https://rundeck.example.org" api_token: "mytoken" state: absent -''' +""" -RETURN = ''' +RETURN = r""" rundeck_response: - description: Rundeck response when a failure occurs - returned: failed - type: str + description: Rundeck response when a failure occurs. + returned: failed + type: str before: - description: dictionary containing project information before modification - returned: success - type: dict + description: Dictionary containing project information before modification. + returned: success + type: dict after: - description: dictionary containing project information after modification - returned: success - type: dict -''' + description: Dictionary containing project information after modification. + returned: success + type: dict +""" # import module snippets from ansible.module_utils.basic import AnsibleModule diff --git a/plugins/modules/runit.py b/plugins/modules/runit.py index 2f1609ca6e..221b87b0dd 100644 --- a/plugins/modules/runit.py +++ b/plugins/modules/runit.py @@ -8,54 +8,50 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -DOCUMENTATION = r''' ---- +DOCUMENTATION = r""" module: runit author: - - James Sumners (@jsumners) + - James Sumners (@jsumners) short_description: Manage runit services description: - - Controls runit services on remote hosts using the sv utility. + - Controls runit services on remote hosts using the sv utility. extends_documentation_fragment: - - community.general.attributes + - community.general.attributes attributes: - check_mode: - support: full - diff_mode: - support: none + check_mode: + support: full + diff_mode: + support: none options: - name: - description: - - Name of the service to manage. - type: str - required: true - state: - description: - - V(started)/V(stopped) are idempotent actions that will not run - commands unless necessary. V(restarted) will always bounce the - service (sv restart) and V(killed) will always bounce the service (sv force-stop). - V(reloaded) will send a HUP (sv reload). - V(once) will run a normally downed sv once (sv once), not really - an idempotent operation. - type: str - choices: [ killed, once, reloaded, restarted, started, stopped ] - enabled: - description: - - Whether the service is enabled or not, if disabled it also implies stopped. - type: bool - service_dir: - description: - - directory runsv watches for services - type: str - default: /var/service - service_src: - description: - - directory where services are defined, the source of symlinks to service_dir. - type: str - default: /etc/sv -''' + name: + description: + - Name of the service to manage. + type: str + required: true + state: + description: + - V(started)/V(stopped) are idempotent actions that will not run commands unless necessary. V(restarted) will always bounce the service + (sv restart) and V(killed) will always bounce the service (sv force-stop). V(reloaded) will send a HUP (sv reload). V(once) will run a + normally downed sv once (sv once), not really an idempotent operation. + type: str + choices: [killed, once, reloaded, restarted, started, stopped] + enabled: + description: + - Whether the service is enabled or not, if disabled it also implies stopped. + type: bool + service_dir: + description: + - Directory runsv watches for services. + type: str + default: /var/service + service_src: + description: + - Directory where services are defined, the source of symlinks to O(service_dir). + type: str + default: /etc/sv +""" -EXAMPLES = r''' +EXAMPLES = r""" - name: Start sv dnscache, if not running community.general.runit: name: dnscache @@ -86,7 +82,7 @@ EXAMPLES = r''' name: dnscache state: reloaded service_dir: /run/service -''' +""" import os import re