r*: normalize docs (#9354)

* r*: normalize docs

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

* Apply suggestions from code review

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
pull/9101/merge
Alexei Znamensky 2024-12-26 09:19:49 +13:00 committed by GitHub
parent 70b62ed745
commit 9751461295
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 1858 additions and 1947 deletions

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 (

View File

@ -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 (

View File

@ -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 (

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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