[oc ... onep]*.py: normalize docs (#9382)

* [oc ... onep]*.py: normalize docs

* Apply suggestions from code review

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

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
pull/8676/merge
Alexei Znamensky 2024-12-27 01:44:29 +13:00 committed by GitHub
parent 49ed3d4acf
commit 88330575ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 1807 additions and 1934 deletions

View File

@ -8,14 +8,12 @@
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: ocapi_command module: ocapi_command
version_added: 6.3.0 version_added: 6.3.0
short_description: Manages Out-Of-Band controllers using Open Composable API (OCAPI) short_description: Manages Out-Of-Band controllers using Open Composable API (OCAPI)
description: description:
- Builds OCAPI URIs locally and sends them to remote OOB controllers to - Builds OCAPI URIs locally and sends them to remote OOB controllers to perform an action.
perform an action.
- Manages OOB controller such as Indicator LED, Reboot, Power Mode, Firmware Update. - Manages OOB controller such as Indicator LED, Reboot, Power Mode, Firmware Update.
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
@ -70,10 +68,10 @@ options:
type: int type: int
author: "Mike Moerk (@mikemoerk)" author: "Mike Moerk (@mikemoerk)"
''' """
EXAMPLES = ''' EXAMPLES = r"""
- name: Set the power state to low - name: Set the power state to low
community.general.ocapi_command: community.general.ocapi_command:
category: Chassis category: Chassis
command: PowerModeLow command: PowerModeLow
@ -81,14 +79,14 @@ EXAMPLES = '''
username: "{{ username }}" username: "{{ username }}"
password: "{{ password }}" password: "{{ password }}"
- name: Set the power state to normal - name: Set the power state to normal
community.general.ocapi_command: community.general.ocapi_command:
category: Chassis category: Chassis
command: PowerModeNormal command: PowerModeNormal
baseuri: "{{ baseuri }}" baseuri: "{{ baseuri }}"
username: "{{ username }}" username: "{{ username }}"
password: "{{ password }}" password: "{{ password }}"
- name: Set chassis indicator LED to on - name: Set chassis indicator LED to on
community.general.ocapi_command: community.general.ocapi_command:
category: Chassis category: Chassis
command: IndicatorLedOn command: IndicatorLedOn
@ -96,7 +94,7 @@ EXAMPLES = '''
proxy_slot_number: 2 proxy_slot_number: 2
username: "{{ username }}" username: "{{ username }}"
password: "{{ password }}" password: "{{ password }}"
- name: Set chassis indicator LED to off - name: Set chassis indicator LED to off
community.general.ocapi_command: community.general.ocapi_command:
category: Chassis category: Chassis
command: IndicatorLedOff command: IndicatorLedOff
@ -104,7 +102,7 @@ EXAMPLES = '''
proxy_slot_number: 2 proxy_slot_number: 2
username: "{{ username }}" username: "{{ username }}"
password: "{{ password }}" password: "{{ password }}"
- name: Reset Enclosure - name: Reset Enclosure
community.general.ocapi_command: community.general.ocapi_command:
category: Systems category: Systems
command: PowerGracefulRestart command: PowerGracefulRestart
@ -112,7 +110,7 @@ EXAMPLES = '''
proxy_slot_number: 2 proxy_slot_number: 2
username: "{{ username }}" username: "{{ username }}"
password: "{{ password }}" password: "{{ password }}"
- name: Firmware Upload - name: Firmware Upload
community.general.ocapi_command: community.general.ocapi_command:
category: Update category: Update
command: FWUpload command: FWUpload
@ -121,7 +119,7 @@ EXAMPLES = '''
username: "{{ username }}" username: "{{ username }}"
password: "{{ password }}" password: "{{ password }}"
update_image_path: "/path/to/firmware.tar.gz" update_image_path: "/path/to/firmware.tar.gz"
- name: Firmware Update - name: Firmware Update
community.general.ocapi_command: community.general.ocapi_command:
category: Update category: Update
command: FWUpdate command: FWUpdate
@ -129,7 +127,7 @@ EXAMPLES = '''
proxy_slot_number: 2 proxy_slot_number: 2
username: "{{ username }}" username: "{{ username }}"
password: "{{ password }}" password: "{{ password }}"
- name: Firmware Activate - name: Firmware Activate
community.general.ocapi_command: community.general.ocapi_command:
category: Update category: Update
command: FWActivate command: FWActivate
@ -137,7 +135,7 @@ EXAMPLES = '''
proxy_slot_number: 2 proxy_slot_number: 2
username: "{{ username }}" username: "{{ username }}"
password: "{{ password }}" password: "{{ password }}"
- name: Delete Job - name: Delete Job
community.general.ocapi_command: community.general.ocapi_command:
category: Jobs category: Jobs
command: DeleteJob command: DeleteJob
@ -146,9 +144,9 @@ EXAMPLES = '''
proxy_slot_number: 2 proxy_slot_number: 2
username: "{{ username }}" username: "{{ username }}"
password: "{{ password }}" password: "{{ password }}"
''' """
RETURN = ''' RETURN = r"""
msg: msg:
description: Message with action result or error description. description: Message with action result or error description.
returned: always returned: always
@ -166,8 +164,7 @@ operationStatusId:
returned: when supported returned: when supported
type: int type: int
sample: 2 sample: 2
"""
'''
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.general.plugins.module_utils.ocapi_utils import OcapiUtils from ansible_collections.community.general.plugins.module_utils.ocapi_utils import OcapiUtils

View File

@ -10,14 +10,12 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: ocapi_info module: ocapi_info
version_added: 6.3.0 version_added: 6.3.0
short_description: Manages Out-Of-Band controllers using Open Composable API (OCAPI) short_description: Manages Out-Of-Band controllers using Open Composable API (OCAPI)
description: description:
- Builds OCAPI URIs locally and sends them to remote OOB controllers to - Builds OCAPI URIs locally and sends them to remote OOB controllers to get information back.
get information back.
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
- community.general.attributes.info_module - community.general.attributes.info_module
@ -62,10 +60,10 @@ options:
author: "Mike Moerk (@mikemoerk)" author: "Mike Moerk (@mikemoerk)"
''' """
EXAMPLES = ''' EXAMPLES = r"""
- name: Get job status - name: Get job status
community.general.ocapi_info: community.general.ocapi_info:
category: Status category: Status
command: JobStatus command: JobStatus
@ -73,9 +71,9 @@ EXAMPLES = '''
jobName: FirmwareUpdate jobName: FirmwareUpdate
username: "{{ username }}" username: "{{ username }}"
password: "{{ password }}" password: "{{ password }}"
''' """
RETURN = ''' RETURN = r"""
msg: msg:
description: Message with action result or error description. description: Message with action result or error description.
returned: always returned: always
@ -107,9 +105,9 @@ operationHealth:
sample: "OK" sample: "OK"
operationHealthId: operationHealthId:
description: > description: >-
Integer value for health of the operation (corresponds to RV(operationHealth)). Applies to O(command=JobStatus). Integer value for health of the operation (corresponds to RV(operationHealth)). Applies to O(command=JobStatus). See OCAPI documentation for
See OCAPI documentation for details. details.
returned: when supported returned: when supported
type: str type: str
sample: "OK" sample: "OK"
@ -139,7 +137,7 @@ status:
"Name": "In service" "Name": "In service"
} }
} }
''' """
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.general.plugins.module_utils.ocapi_utils import OcapiUtils from ansible_collections.community.general.plugins.module_utils.ocapi_utils import OcapiUtils

View File

@ -8,14 +8,12 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: oci_vcn module: oci_vcn
short_description: Manage Virtual Cloud Networks(VCN) in OCI short_description: Manage Virtual Cloud Networks(VCN) in OCI
description: description:
- This module allows the user to create, delete and update virtual cloud networks(VCNs) in OCI. - This module allows the user to create, delete and update virtual cloud networks(VCNs) in OCI. The complete Oracle Cloud Infrastructure Ansible
The complete Oracle Cloud Infrastructure Ansible Modules can be downloaded from Modules can be downloaded from U(https://github.com/oracle/oci-ansible-modules/releases).
U(https://github.com/oracle/oci-ansible-modules/releases).
attributes: attributes:
check_mode: check_mode:
support: none support: none
@ -27,19 +25,18 @@ options:
type: str type: str
required: false required: false
compartment_id: compartment_id:
description: The OCID of the compartment to contain the VCN. Required when creating a VCN with O(state=present). description: The OCID of the compartment to contain the VCN. Required when creating a VCN with O(state=present). This option is mutually exclusive
This option is mutually exclusive with O(vcn_id). with O(vcn_id).
type: str type: str
display_name: display_name:
description: A user-friendly name. Does not have to be unique, and it's changeable. description: A user-friendly name. Does not have to be unique, and it's changeable.
type: str type: str
aliases: [ 'name' ] aliases: ['name']
dns_label: dns_label:
description: A DNS label for the VCN, used in conjunction with the VNIC's hostname and subnet's DNS label to description: A DNS label for the VCN, used in conjunction with the VNIC's hostname and subnet's DNS label to form a fully qualified domain
form a fully qualified domain name (FQDN) for each VNIC within this subnet (for example, name (FQDN) for each VNIC within this subnet (for example, V(bminstance-1.subnet123.vcn1.oraclevcn.com)). Not required to be unique, but it's
bminstance-1.subnet123.vcn1.oraclevcn.com). Not required to be unique, but it's a best practice a best practice to set unique DNS labels for VCNs in your tenancy. Must be an alphanumeric string that begins with a letter. The value cannot
to set unique DNS labels for VCNs in your tenancy. Must be an alphanumeric string that begins be changed.
with a letter. The value cannot be changed.
type: str type: str
state: state:
description: Create or update a VCN with O(state=present). Use O(state=absent) to delete a VCN. description: Create or update a VCN with O(state=present). Use O(state=absent) to delete a VCN.
@ -47,10 +44,10 @@ options:
default: present default: present
choices: ['present', 'absent'] choices: ['present', 'absent']
vcn_id: vcn_id:
description: The OCID of the VCN. Required when deleting a VCN with O(state=absent) or updating a VCN description: The OCID of the VCN. Required when deleting a VCN with O(state=absent) or updating a VCN with O(state=present). This option is
with O(state=present). This option is mutually exclusive with O(compartment_id). mutually exclusive with O(compartment_id).
type: str type: str
aliases: [ 'id' ] aliases: ['id']
author: "Rohit Chaware (@rohitChaware)" author: "Rohit Chaware (@rohitChaware)"
extends_documentation_fragment: extends_documentation_fragment:
- community.general.oracle - community.general.oracle
@ -58,10 +55,9 @@ extends_documentation_fragment:
- community.general.oracle_wait_options - community.general.oracle_wait_options
- community.general.oracle_tags - community.general.oracle_tags
- community.general.attributes - community.general.attributes
"""
''' EXAMPLES = r"""
EXAMPLES = """
- name: Create a VCN - name: Create a VCN
community.general.oci_vcn: community.general.oci_vcn:
cidr_block: '10.0.0.0/16' cidr_block: '10.0.0.0/16'
@ -80,7 +76,7 @@ EXAMPLES = """
state: absent state: absent
""" """
RETURN = """ RETURN = r"""
vcn: vcn:
description: Information about the VCN description: Information about the VCN
returned: On successful create and update operation returned: On successful create and update operation

View File

@ -8,14 +8,13 @@
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: odbc module: odbc
author: "John Westcott IV (@john-westcott-iv)" author: "John Westcott IV (@john-westcott-iv)"
version_added: "1.0.0" version_added: "1.0.0"
short_description: Execute SQL via ODBC short_description: Execute SQL using ODBC
description: description:
- Read/Write info via ODBC drivers. - Read/Write info using ODBC drivers.
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
attributes: attributes:
@ -51,12 +50,12 @@ requirements:
- "pyodbc" - "pyodbc"
notes: notes:
- "Like the command module, this module always returns changed = yes whether or not the query would change the database." - Like the command module, this module always returns V(changed=true) whether or not the query would change the database.
- "To alter this behavior you can use C(changed_when): [yes or no]." - 'To alter this behavior you can use C(changed_when): [true or false].'
- "For details about return values (description and row_count) see U(https://github.com/mkleehammer/pyodbc/wiki/Cursor)." - For details about return values (RV(description) and RV(row_count)) see U(https://github.com/mkleehammer/pyodbc/wiki/Cursor).
''' """
EXAMPLES = ''' EXAMPLES = r"""
- name: Set some values in the test db - name: Set some values in the test db
community.general.odbc: community.general.odbc:
dsn: "DRIVER={ODBC Driver 13 for SQL Server};Server=db.ansible.com;Database=my_db;UID=admin;PWD=password;" dsn: "DRIVER={ODBC Driver 13 for SQL Server};Server=db.ansible.com;Database=my_db;UID=admin;PWD=password;"
@ -65,9 +64,9 @@ EXAMPLES = '''
- "value1" - "value1"
commit: false commit: false
changed_when: false changed_when: false
''' """
RETURN = ''' RETURN = r"""
results: results:
description: List of lists of strings containing selected rows, likely empty for DDL statements. description: List of lists of strings containing selected rows, likely empty for DDL statements.
returned: success returned: success
@ -79,10 +78,10 @@ description:
type: list type: list
elements: dict elements: dict
row_count: row_count:
description: "The number of rows selected or modified according to the cursor defaults to -1. See notes." description: "The number of rows selected or modified according to the cursor defaults to V(-1). See notes."
returned: success returned: success
type: str type: str
''' """
from ansible.module_utils.basic import AnsibleModule, missing_required_lib from ansible.module_utils.basic import AnsibleModule, missing_required_lib
from ansible.module_utils.common.text.converters import to_native from ansible.module_utils.common.text.converters import to_native

View File

@ -8,17 +8,15 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
module: office_365_connector_card module: office_365_connector_card
short_description: Use webhooks to create Connector Card messages within an Office 365 group short_description: Use webhooks to create Connector Card messages within an Office 365 group
description: description:
- Creates Connector Card messages through - Creates Connector Card messages through Office 365 Connectors.
Office 365 Connectors - See U(https://learn.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/cards-reference#connector-card-for-microsoft-365-groups).
U(https://learn.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/cards-reference#connector-card-for-microsoft-365-groups).
author: "Marc Sensenich (@marc-sensenich)" author: "Marc Sensenich (@marc-sensenich)"
notes: notes:
- This module is not idempotent, therefore if the same task is run twice - This module is not idempotent, therefore if the same task is run twice there will be two Connector Cards created.
there will be two Connector Cards created
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
attributes: attributes:
@ -37,7 +35,7 @@ options:
description: description:
- A string used for summarizing card content. - A string used for summarizing card content.
- This will be shown as the message subject. - This will be shown as the message subject.
- This is required if the text parameter isn't populated. - This is required if the text parameter is not populated.
color: color:
type: str type: str
description: description:
@ -51,22 +49,21 @@ options:
description: description:
- The main text of the card. - The main text of the card.
- This will be rendered below the sender information and optional title, - This will be rendered below the sender information and optional title,
- and above any sections or actions present. - And above any sections or actions present.
actions: actions:
type: list type: list
elements: dict elements: dict
description: description:
- This array of objects will power the action links - This array of objects will power the action links found at the bottom of the card.
- found at the bottom of the card.
sections: sections:
type: list type: list
elements: dict elements: dict
description: description:
- Contains a list of sections to display in the card. - Contains a list of sections to display in the card.
- For more information see U(https://learn.microsoft.com/en-us/outlook/actionable-messages/message-card-reference#section-fields). - For more information see U(https://learn.microsoft.com/en-us/outlook/actionable-messages/message-card-reference#section-fields).
''' """
EXAMPLES = """ EXAMPLES = r"""
- name: Create a simple Connector Card - name: Create a simple Connector Card
community.general.office_365_connector_card: community.general.office_365_connector_card:
webhook: https://outlook.office.com/webhook/GUID/IncomingWebhook/GUID/GUID webhook: https://outlook.office.com/webhook/GUID/IncomingWebhook/GUID/GUID
@ -77,8 +74,8 @@ EXAMPLES = """
webhook: https://outlook.office.com/webhook/GUID/IncomingWebhook/GUID/GUID webhook: https://outlook.office.com/webhook/GUID/IncomingWebhook/GUID/GUID
summary: This is the summary property summary: This is the summary property
title: This is the **card's title** property title: This is the **card's title** property
text: This is the **card's text** property. Lorem ipsum dolor sit amet, consectetur text: This is the **card's text** property. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. labore et dolore magna aliqua.
color: E81123 color: E81123
sections: sections:
- title: This is the **section's title** property - title: This is the **section's title** property
@ -89,8 +86,8 @@ EXAMPLES = """
hero_image: hero_image:
image: http://connectorsdemo.azurewebsites.net/images/WIN12_Scene_01.jpg image: http://connectorsdemo.azurewebsites.net/images/WIN12_Scene_01.jpg
title: This is the image's alternate text title: This is the image's alternate text
text: This is the section's text property. Lorem ipsum dolor sit amet, consectetur text: This is the section's text property. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ut labore et dolore magna aliqua.
facts: facts:
- name: This is a fact name - name: This is a fact name
value: This is a fact value value: This is a fact value
@ -137,11 +134,10 @@ EXAMPLES = """
uri: http://... uri: http://...
- start_group: true - start_group: true
title: This is the title of a **second section** title: This is the title of a **second section**
text: This second section is visually separated from the first one by setting its text: This second section is visually separated from the first one by setting its **startGroup** property to true.
**startGroup** property to true.
""" """
RETURN = """ RETURN = r"""
""" """
# import module snippets # import module snippets

View File

@ -9,15 +9,12 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: ohai module: ohai
short_description: Returns inventory data from I(Ohai) short_description: Returns inventory data from I(Ohai)
description: description:
- Similar to the M(community.general.facter) module, this runs the I(Ohai) discovery program - Similar to the M(community.general.facter) module, this runs the I(Ohai) discovery program (U(https://docs.chef.io/ohai.html)) on the remote
(U(https://docs.chef.io/ohai.html)) on the remote host and host and returns JSON inventory data. I(Ohai) data is a bit more verbose and nested than I(facter).
returns JSON inventory data.
I(Ohai) data is a bit more verbose and nested than I(facter).
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
attributes: attributes:
@ -27,16 +24,16 @@ attributes:
support: none support: none
options: {} options: {}
notes: [] notes: []
requirements: [ "ohai" ] requirements: ["ohai"]
author: author:
- "Ansible Core Team" - "Ansible Core Team"
- "Michael DeHaan (@mpdehaan)" - "Michael DeHaan (@mpdehaan)"
''' """
EXAMPLES = ''' EXAMPLES = r"""
# Retrieve (ohai) data from all Web servers and store in one-file per host
ansible webservers -m ohai --tree=/tmp/ohaidata ansible webservers -m ohai --tree=/tmp/ohaidata
''' ...
"""
import json import json
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule

View File

@ -10,11 +10,10 @@
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = r''' DOCUMENTATION = r"""
---
module: omapi_host module: omapi_host
short_description: Setup OMAPI hosts short_description: Setup OMAPI hosts
description: Manage OMAPI hosts into compatible DHCPd servers description: Manage OMAPI hosts into compatible DHCPd servers.
requirements: requirements:
- pypureomapi - pypureomapi
author: author:
@ -32,12 +31,12 @@ options:
- Create or remove OMAPI host. - Create or remove OMAPI host.
type: str type: str
required: true required: true
choices: [ absent, present ] choices: [absent, present]
hostname: hostname:
description: description:
- Sets the host lease hostname (mandatory if state=present). - Sets the host lease hostname (mandatory if O(state=present)).
type: str type: str
aliases: [ name ] aliases: [name]
host: host:
description: description:
- Sets OMAPI server host to interact with. - Sets OMAPI server host to interact with.
@ -78,9 +77,8 @@ options:
- Enable dynamic DNS updates for this host. - Enable dynamic DNS updates for this host.
type: bool type: bool
default: false default: false
"""
''' EXAMPLES = r"""
EXAMPLES = r'''
- name: Add a host using OMAPI - name: Add a host using OMAPI
community.general.omapi_host: community.general.omapi_host:
key_name: defomapi key_name: defomapi
@ -102,11 +100,11 @@ EXAMPLES = r'''
host: 10.1.1.1 host: 10.1.1.1
macaddr: 00:66:ab:dd:11:44 macaddr: 00:66:ab:dd:11:44
state: absent state: absent
''' """
RETURN = r''' RETURN = r"""
lease: lease:
description: dictionary containing host information description: Dictionary containing host information.
returned: success returned: success
type: complex type: complex
contains: contains:
@ -116,21 +114,21 @@ lease:
type: str type: str
sample: '192.168.1.5' sample: '192.168.1.5'
hardware-address: hardware-address:
description: MAC address description: MAC address.
returned: success returned: success
type: str type: str
sample: '00:11:22:33:44:55' sample: '00:11:22:33:44:55'
hardware-type: hardware-type:
description: hardware type, generally '1' description: Hardware type, generally V(1).
returned: success returned: success
type: int type: int
sample: 1 sample: 1
name: name:
description: hostname description: Hostname.
returned: success returned: success
type: str type: str
sample: 'mydesktop' sample: 'mydesktop'
''' """
import binascii import binascii
import socket import socket

View File

@ -10,8 +10,7 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: one_host module: one_host
short_description: Manages OpenNebula Hosts short_description: Manages OpenNebula Hosts
@ -21,8 +20,7 @@ requirements:
- pyone - pyone
description: description:
- "Manages OpenNebula Hosts" - Manages OpenNebula Hosts.
attributes: attributes:
check_mode: check_mode:
support: none support: none
@ -41,7 +39,7 @@ options:
- If V(absent) the host will be deleted from the cluster. - If V(absent) the host will be deleted from the cluster.
- If V(present) the host will be created in the cluster (includes V(enabled), V(disabled) and V(offline) states). - If V(present) the host will be created in the cluster (includes V(enabled), V(disabled) and V(offline) states).
- If V(enabled) the host is fully operational. - If V(enabled) the host is fully operational.
- V(disabled), e.g. to perform maintenance operations. - V(disabled), for example to perform maintenance operations.
- V(offline), host is totally offline. - V(offline), host is totally offline.
choices: choices:
- absent - absent
@ -53,12 +51,12 @@ options:
type: str type: str
im_mad_name: im_mad_name:
description: description:
- The name of the information manager, this values are taken from the oned.conf with the tag name IM_MAD (name) - The name of the information manager, this values are taken from the oned.conf with the tag name IM_MAD (name).
default: kvm default: kvm
type: str type: str
vmm_mad_name: vmm_mad_name:
description: description:
- The name of the virtual machine manager mad name, this values are taken from the oned.conf with the tag name VM_MAD (name) - The name of the virtual machine manager mad name, this values are taken from the oned.conf with the tag name VM_MAD (name).
default: kvm default: kvm
type: str type: str
cluster_id: cluster_id:
@ -88,9 +86,9 @@ extends_documentation_fragment:
author: author:
- Rafael del Valle (@rvalle) - Rafael del Valle (@rvalle)
''' """
EXAMPLES = ''' EXAMPLES = r"""
- name: Create a new host in OpenNebula - name: Create a new host in OpenNebula
community.general.one_host: community.general.one_host:
name: host1 name: host1
@ -106,11 +104,11 @@ EXAMPLES = '''
- gold - gold
- ssd - ssd
RESERVED_CPU: -100 RESERVED_CPU: -100
''' """
# TODO: pending setting guidelines on returned values # TODO: pending setting guidelines on returned values
RETURN = ''' RETURN = r"""
''' """
# TODO: Documentation on valid state transitions is required to properly implement all valid cases # TODO: Documentation on valid state transitions is required to properly implement all valid cases
# TODO: To be coherent with CLI this module should also provide "flush" functionality # TODO: To be coherent with CLI this module should also provide "flush" functionality

View File

@ -8,12 +8,11 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: one_image module: one_image
short_description: Manages OpenNebula images short_description: Manages OpenNebula images
description: description:
- Manages OpenNebula images - Manages OpenNebula images.
requirements: requirements:
- pyone - pyone
extends_documentation_fragment: extends_documentation_fragment:
@ -81,9 +80,9 @@ options:
version_added: 10.0.0 version_added: 10.0.0
author: author:
- "Milan Ilic (@ilicmilan)" - "Milan Ilic (@ilicmilan)"
''' """
EXAMPLES = ''' EXAMPLES = r"""
- name: Fetch the IMAGE by id - name: Fetch the IMAGE by id
community.general.one_image: community.general.one_image:
id: 45 id: 45
@ -147,58 +146,58 @@ EXAMPLES = '''
create: true create: true
datastore_id: 100 datastore_id: 100
wait_timeout: 900 wait_timeout: 900
template: | template: |-
PATH = "https://192.0.2.200/repo/tipa_image.raw" PATH = "https://192.0.2.200/repo/tipa_image.raw"
TYPE = "OS" TYPE = "OS"
SIZE = 82048 SIZE = 82048
FORMAT = "raw" FORMAT = "raw"
PERSISTENT = "Yes" PERSISTENT = "Yes"
DEV_PREFIX = "vd" DEV_PREFIX = "vd"
''' """
RETURN = ''' RETURN = r"""
id: id:
description: image id description: Image id.
type: int type: int
returned: when O(state=present), O(state=cloned), or O(state=renamed) returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample: 153 sample: 153
name: name:
description: image name description: Image name.
type: str type: str
returned: when O(state=present), O(state=cloned), or O(state=renamed) returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample: app1 sample: app1
group_id: group_id:
description: image's group id description: Image's group id.
type: int type: int
returned: when O(state=present), O(state=cloned), or O(state=renamed) returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample: 1 sample: 1
group_name: group_name:
description: image's group name description: Image's group name.
type: str type: str
returned: when O(state=present), O(state=cloned), or O(state=renamed) returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample: one-users sample: one-users
owner_id: owner_id:
description: image's owner id description: Image's owner id.
type: int type: int
returned: when O(state=present), O(state=cloned), or O(state=renamed) returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample: 143 sample: 143
owner_name: owner_name:
description: image's owner name description: Image's owner name.
type: str type: str
returned: when O(state=present), O(state=cloned), or O(state=renamed) returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample: ansible-test sample: ansible-test
state: state:
description: state of image instance description: State of image instance.
type: str type: str
returned: when O(state=present), O(state=cloned), or O(state=renamed) returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample: READY sample: READY
used: used:
description: is image in use description: Is image in use.
type: bool type: bool
returned: when O(state=present), O(state=cloned), or O(state=renamed) returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample: true sample: true
running_vms: running_vms:
description: count of running vms that use this image description: Count of running vms that use this image.
type: int type: int
returned: when O(state=present), O(state=cloned), or O(state=renamed) returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample: 7 sample: 7
@ -241,7 +240,7 @@ permissions:
type: str type: str
sample: 0 sample: 0
other_a: other_a:
description: The image's other users ADMIN permissions description: The image's other users ADMIN permissions.
type: str type: str
sample: 0 sample: 0
sample: sample:
@ -368,7 +367,7 @@ snapshots:
children: 0 children: 0
active: 1 active: 1
name: SampleName name: SampleName
''' """
from ansible_collections.community.general.plugins.module_utils.opennebula import OpenNebulaModule from ansible_collections.community.general.plugins.module_utils.opennebula import OpenNebulaModule

View File

@ -8,8 +8,7 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: one_image_info module: one_image_info
short_description: Gather information on OpenNebula images short_description: Gather information on OpenNebula images
description: description:
@ -31,17 +30,17 @@ options:
name: name:
description: description:
- A O(name) of the image whose facts will be gathered. - A O(name) of the image whose facts will be gathered.
- If the O(name) begins with V(~) the O(name) will be used as regex pattern - If the O(name) begins with V(~) the O(name) will be used as regex pattern,
- which restricts the list of images (whose facts will be returned) whose names match specified regex. which restricts the list of images (whose facts will be returned) whose names match specified regex.
- Also, if the O(name) begins with V(~*) case-insensitive matching will be performed. - Also, if the O(name) begins with V(~*) case-insensitive matching will be performed.
- See examples for more details. - See examples for more details.
type: str type: str
author: author:
- "Milan Ilic (@ilicmilan)" - "Milan Ilic (@ilicmilan)"
- "Jan Meerkamp (@meerkampdvv)" - "Jan Meerkamp (@meerkampdvv)"
''' """
EXAMPLES = ''' EXAMPLES = r"""
- name: Gather facts about all images - name: Gather facts about all images
community.general.one_image_info: community.general.one_image_info:
register: result register: result
@ -76,11 +75,11 @@ EXAMPLES = '''
community.general.one_image_info: community.general.one_image_info:
name: '~*foo-image-.*' name: '~*foo-image-.*'
register: foo_images register: foo_images
''' """
RETURN = ''' RETURN = r"""
images: images:
description: A list of images info description: A list of images info.
type: complex type: complex
returned: success returned: success
contains: contains:
@ -93,7 +92,7 @@ images:
type: str type: str
sample: app1 sample: app1
group_id: group_id:
description: The image's group id description: The image's group id.
type: int type: int
sample: 1 sample: 1
group_name: group_name:
@ -158,7 +157,7 @@ images:
type: str type: str
sample: 0 sample: 0
other_a: other_a:
description: The image's other users ADMIN permissions description: The image's other users ADMIN permissions.
type: str type: str
sample: 0 sample: 0
sample: sample:
@ -270,7 +269,7 @@ images:
children: 0 children: 0
active: 1 active: 1
name: SampleName name: SampleName
''' """
from ansible_collections.community.general.plugins.module_utils.opennebula import OpenNebulaModule from ansible_collections.community.general.plugins.module_utils.opennebula import OpenNebulaModule

View File

@ -8,12 +8,11 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: one_service module: one_service
short_description: Deploy and manage OpenNebula services short_description: Deploy and manage OpenNebula services
description: description:
- Manage OpenNebula services - Manage OpenNebula services.
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
attributes: attributes:
@ -30,11 +29,13 @@ options:
type: str type: str
api_username: api_username:
description: description:
- Name of the user to login into the OpenNebula OneFlow API server. If not set then the value of the E(ONEFLOW_USERNAME) environment variable is used. - Name of the user to login into the OpenNebula OneFlow API server. If not set then the value of the E(ONEFLOW_USERNAME) environment variable
is used.
type: str type: str
api_password: api_password:
description: description:
- Password of the user to login into OpenNebula OneFlow API server. If not set then the value of the E(ONEFLOW_PASSWORD) environment variable is used. - Password of the user to login into OpenNebula OneFlow API server. If not set then the value of the E(ONEFLOW_PASSWORD) environment variable
is used.
type: str type: str
template_name: template_name:
description: description:
@ -54,8 +55,8 @@ options:
type: str type: str
unique: unique:
description: description:
- Setting O(unique=true) will make sure that there is only one service instance running with a name set with O(service_name) when - Setting O(unique=true) will make sure that there is only one service instance running with a name set with O(service_name) when instantiating
instantiating a service from a template specified with O(template_id) or O(template_name). Check examples below. a service from a template specified with O(template_id) or O(template_name). Check examples below.
type: bool type: bool
default: false default: false
state: state:
@ -67,7 +68,8 @@ options:
type: str type: str
mode: mode:
description: description:
- Set permission mode of a service instance in octet format, for example V(0600) to give owner C(use) and C(manage) and nothing to group and others. - Set permission mode of a service instance in octet format, for example V(0600) to give owner C(use) and C(manage) and nothing to group
and others.
type: str type: str
owner_id: owner_id:
description: description:
@ -107,9 +109,9 @@ options:
default: false default: false
author: author:
- "Milan Ilic (@ilicmilan)" - "Milan Ilic (@ilicmilan)"
''' """
EXAMPLES = ''' EXAMPLES = r"""
- name: Instantiate a new service - name: Instantiate a new service
community.general.one_service: community.general.one_service:
template_id: 90 template_id: 90
@ -178,57 +180,57 @@ EXAMPLES = '''
role: foo role: foo
cardinality: 7 cardinality: 7
wait: true wait: true
''' """
RETURN = ''' RETURN = r"""
service_id: service_id:
description: service id description: Service id.
type: int type: int
returned: success returned: success
sample: 153 sample: 153
service_name: service_name:
description: service name description: Service name.
type: str type: str
returned: success returned: success
sample: app1 sample: app1
group_id: group_id:
description: service's group id description: Service's group id.
type: int type: int
returned: success returned: success
sample: 1 sample: 1
group_name: group_name:
description: service's group name description: Service's group name.
type: str type: str
returned: success returned: success
sample: one-users sample: one-users
owner_id: owner_id:
description: service's owner id description: Service's owner id.
type: int type: int
returned: success returned: success
sample: 143 sample: 143
owner_name: owner_name:
description: service's owner name description: Service's owner name.
type: str type: str
returned: success returned: success
sample: ansible-test sample: ansible-test
state: state:
description: state of service instance description: State of service instance.
type: str type: str
returned: success returned: success
sample: RUNNING sample: RUNNING
mode: mode:
description: service's mode description: Service's mode.
type: int type: int
returned: success returned: success
sample: 660 sample: 660
roles: roles:
description: list of dictionaries of roles, each role is described by name, cardinality, state and nodes ids description: List of dictionaries of roles, each role is described by name, cardinality, state and nodes ids.
type: list type: list
returned: success returned: success
sample: sample:
- {"cardinality": 1,"name": "foo","state": "RUNNING", "ids": [ 123, 456 ]} - {"cardinality": 1, "name": "foo", "state": "RUNNING", "ids": [123, 456]}
- {"cardinality": 2,"name": "bar","state": "RUNNING", "ids": [ 452, 567, 746 ]} - {"cardinality": 2, "name": "bar", "state": "RUNNING", "ids": [452, 567, 746]}
''' """
import os import os
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule

View File

@ -9,8 +9,7 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: one_template module: one_template
short_description: Manages OpenNebula templates short_description: Manages OpenNebula templates
@ -21,8 +20,7 @@ requirements:
- pyone - pyone
description: description:
- "Manages OpenNebula templates." - Manages OpenNebula templates.
attributes: attributes:
check_mode: check_mode:
support: partial support: partial
@ -34,14 +32,12 @@ attributes:
options: options:
id: id:
description: description:
- A O(id) of the template you would like to manage. If not set then a - A O(id) of the template you would like to manage. If not set then a new template will be created with the given O(name).
- new template will be created with the given O(name).
type: int type: int
name: name:
description: description:
- A O(name) of the template you would like to manage. If a template with - A O(name) of the template you would like to manage.
- the given name does not exist it will be created, otherwise it will be If a template with the given name does not exist it will be created, otherwise it will be managed by this module.
- managed by this module.
type: str type: str
template: template:
description: description:
@ -61,9 +57,9 @@ extends_documentation_fragment:
author: author:
- "Jyrki Gadinger (@nilsding)" - "Jyrki Gadinger (@nilsding)"
''' """
EXAMPLES = ''' EXAMPLES = r"""
- name: Fetch the TEMPLATE by id - name: Fetch the TEMPLATE by id
community.general.one_template: community.general.one_template:
id: 6459 id: 6459
@ -110,44 +106,44 @@ EXAMPLES = '''
community.general.one_template: community.general.one_template:
id: 6459 id: 6459
state: absent state: absent
''' """
RETURN = ''' RETURN = r"""
id: id:
description: template id description: Template id.
type: int type: int
returned: when O(state=present) returned: when O(state=present)
sample: 153 sample: 153
name: name:
description: template name description: Template name.
type: str type: str
returned: when O(state=present) returned: when O(state=present)
sample: app1 sample: app1
template: template:
description: the parsed template description: The parsed template.
type: dict type: dict
returned: when O(state=present) returned: when O(state=present)
group_id: group_id:
description: template's group id description: Template's group id.
type: int type: int
returned: when O(state=present) returned: when O(state=present)
sample: 1 sample: 1
group_name: group_name:
description: template's group name description: Template's group name.
type: str type: str
returned: when O(state=present) returned: when O(state=present)
sample: one-users sample: one-users
owner_id: owner_id:
description: template's owner id description: Template's owner id.
type: int type: int
returned: when O(state=present) returned: when O(state=present)
sample: 143 sample: 143
owner_name: owner_name:
description: template's owner name description: Template's owner name.
type: str type: str
returned: when O(state=present) returned: when O(state=present)
sample: ansible-test sample: ansible-test
''' """
from ansible_collections.community.general.plugins.module_utils.opennebula import OpenNebulaModule from ansible_collections.community.general.plugins.module_utils.opennebula import OpenNebulaModule

View File

@ -9,12 +9,11 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: one_vm module: one_vm
short_description: Creates or terminates OpenNebula instances short_description: Creates or terminates OpenNebula instances
description: description:
- Manages OpenNebula instances - Manages OpenNebula instances.
requirements: requirements:
- pyone - pyone
extends_documentation_fragment: extends_documentation_fragment:
@ -28,34 +27,30 @@ options:
api_url: api_url:
description: description:
- URL of the OpenNebula RPC server. - URL of the OpenNebula RPC server.
- It is recommended to use HTTPS so that the username/password are not - It is recommended to use HTTPS so that the username/password are not transferred over the network unencrypted.
transferred over the network unencrypted.
- If not set then the value of the E(ONE_URL) environment variable is used. - If not set then the value of the E(ONE_URL) environment variable is used.
type: str type: str
api_username: api_username:
description: description:
- Name of the user to login into the OpenNebula RPC server. If not set - Name of the user to login into the OpenNebula RPC server. If not set then the value of the E(ONE_USERNAME) environment variable is used.
then the value of the E(ONE_USERNAME) environment variable is used.
type: str type: str
api_password: api_password:
description: description:
- Password of the user to login into OpenNebula RPC server. If not set - Password of the user to login into OpenNebula RPC server. If not set then the value of the E(ONE_PASSWORD) environment variable is used.
then the value of the E(ONE_PASSWORD) environment variable is used. if both O(api_username) or O(api_password) are not set, then it will try authenticate with ONE auth file. Default path is "~/.one/one_auth".
if both O(api_username) or O(api_password) are not set, then it will try
authenticate with ONE auth file. Default path is "~/.one/one_auth".
- Set environment variable E(ONE_AUTH) to override this path. - Set environment variable E(ONE_AUTH) to override this path.
type: str type: str
template_name: template_name:
description: description:
- Name of VM template to use to create a new instance - Name of VM template to use to create a new instance.
type: str type: str
template_id: template_id:
description: description:
- ID of a VM template to use to create a new instance - ID of a VM template to use to create a new instance.
type: int type: int
vm_start_on_hold: vm_start_on_hold:
description: description:
- Set to true to put vm on hold while creating - Set to true to put vm on hold while creating.
default: false default: false
type: bool type: bool
instance_ids: instance_ids:
@ -67,10 +62,10 @@ options:
state: state:
description: description:
- V(present) - create instances from a template specified with C(template_id)/C(template_name). - V(present) - create instances from a template specified with C(template_id)/C(template_name).
- V(running) - run instances - V(running) - run instances.
- V(poweredoff) - power-off instances - V(poweredoff) - power-off instances.
- V(rebooted) - reboot instances - V(rebooted) - reboot instances.
- V(absent) - terminate instances - V(absent) - terminate instances.
choices: ["present", "absent", "running", "rebooted", "poweredoff"] choices: ["present", "absent", "running", "rebooted", "poweredoff"]
default: present default: present
type: str type: str
@ -81,64 +76,53 @@ options:
type: bool type: bool
wait: wait:
description: description:
- Wait for the instance to reach its desired state before returning. Keep - Wait for the instance to reach its desired state before returning. Keep in mind if you are waiting for instance to be in running state
in mind if you are waiting for instance to be in running state it it does not mean that you will be able to SSH on that machine only that boot process have started on that instance, see 'wait_for' example
doesn't mean that you will be able to SSH on that machine only that for details.
boot process have started on that instance, see 'wait_for' example for
details.
default: true default: true
type: bool type: bool
wait_timeout: wait_timeout:
description: description:
- How long before wait gives up, in seconds - How long before wait gives up, in seconds.
default: 300 default: 300
type: int type: int
attributes: attributes:
description: description:
- A dictionary of key/value attributes to add to new instances, or for - A dictionary of key/value attributes to add to new instances, or for setting C(state) of instances with these attributes.
setting C(state) of instances with these attributes.
- Keys are case insensitive and OpenNebula automatically converts them to upper case. - Keys are case insensitive and OpenNebula automatically converts them to upper case.
- Be aware C(NAME) is a special attribute which sets the name of the VM when it's deployed. - Be aware V(NAME) is a special attribute which sets the name of the VM when it's deployed.
- C(#) character(s) can be appended to the C(NAME) and the module will automatically add - C(#) character(s) can be appended to the C(NAME) and the module will automatically add indexes to the names of VMs.
indexes to the names of VMs. - 'For example: V(NAME: foo-###) would create VMs with names V(foo-000), V(foo-001),...'
- For example':' C(NAME':' foo-###) would create VMs with names C(foo-000), C(foo-001),... - When used with O(count_attributes) and O(exact_count) the module will match the base name without the index part.
- When used with O(count_attributes) and O(exact_count) the module will
match the base name without the index part.
default: {} default: {}
type: dict type: dict
labels: labels:
description: description:
- A list of labels to associate with new instances, or for setting - A list of labels to associate with new instances, or for setting C(state) of instances with these labels.
C(state) of instances with these labels.
default: [] default: []
type: list type: list
elements: str elements: str
count_attributes: count_attributes:
description: description:
- A dictionary of key/value attributes that can only be used with - A dictionary of key/value attributes that can only be used with O(exact_count) to determine how many nodes based on a specific attributes
O(exact_count) to determine how many nodes based on a specific criteria should be deployed. This can be expressed in multiple ways and is shown in the EXAMPLES section.
attributes criteria should be deployed. This can be expressed in
multiple ways and is shown in the EXAMPLES section.
type: dict type: dict
count_labels: count_labels:
description: description:
- A list of labels that can only be used with O(exact_count) to determine - A list of labels that can only be used with O(exact_count) to determine how many nodes based on a specific labels criteria should be deployed.
how many nodes based on a specific labels criteria should be deployed. This can be expressed in multiple ways and is shown in the EXAMPLES section.
This can be expressed in multiple ways and is shown in the EXAMPLES
section.
type: list type: list
elements: str elements: str
count: count:
description: description:
- Number of instances to launch - Number of instances to launch.
default: 1 default: 1
type: int type: int
exact_count: exact_count:
description: description:
- Indicates how many instances that match O(count_attributes) and - Indicates how many instances that match O(count_attributes) and O(count_labels) parameters should be deployed. Instances are either created
O(count_labels) parameters should be deployed. Instances are either or terminated based on this value.
created or terminated based on this value. - B(NOTE:) Instances with the least IDs will be terminated first.
- 'B(NOTE:) Instances with the least IDs will be terminated first.'
type: int type: int
mode: mode:
description: description:
@ -146,27 +130,25 @@ options:
type: str type: str
owner_id: owner_id:
description: description:
- ID of the user which will be set as the owner of the instance - ID of the user which will be set as the owner of the instance.
type: int type: int
group_id: group_id:
description: description:
- ID of the group which will be set as the group of the instance - ID of the group which will be set as the group of the instance.
type: int type: int
memory: memory:
description: description:
- The size of the memory for new instances (in MB, GB, ...) - The size of the memory for new instances (in MB, GB, ..).
type: str type: str
disk_size: disk_size:
description: description:
- The size of the disk created for new instances (in MB, GB, TB,...). - The size of the disk created for new instances (in MB, GB, TB,...).
- 'B(NOTE:) If The Template hats Multiple Disks the Order of the Sizes is - B(NOTE:) If The Template hats Multiple Disks the Order of the Sizes is matched against the order specified in O(template_id)/O(template_name).
matched against the order specified in O(template_id)/O(template_name).'
type: list type: list
elements: str elements: str
cpu: cpu:
description: description:
- Percentage of CPU divided by 100 required for the new instance. Half a - Percentage of CPU divided by 100 required for the new instance. Half a processor is written 0.5.
processor is written 0.5.
type: float type: float
vcpu: vcpu:
description: description:
@ -183,8 +165,8 @@ options:
- Creates an image from a VM disk. - Creates an image from a VM disk.
- It is a dictionary where you have to specify C(name) of the new image. - It is a dictionary where you have to specify C(name) of the new image.
- Optionally you can specify C(disk_id) of the disk you want to save. By default C(disk_id) is 0. - Optionally you can specify C(disk_id) of the disk you want to save. By default C(disk_id) is 0.
- 'B(NOTE:) This operation will only be performed on the first VM (if more than one VM ID is passed) - B(NOTE:) This operation will only be performed on the first VM (if more than one VM ID is passed) and the VM has to be in the C(poweredoff)
and the VM has to be in the C(poweredoff) state.' state.
- Also this operation will fail if an image with specified C(name) already exists. - Also this operation will fail if an image with specified C(name) already exists.
type: dict type: dict
persistent: persistent:
@ -195,28 +177,28 @@ options:
version_added: '0.2.0' version_added: '0.2.0'
datastore_id: datastore_id:
description: description:
- Name of Datastore to use to create a new instance - Name of Datastore to use to create a new instance.
version_added: '0.2.0' version_added: '0.2.0'
type: int type: int
datastore_name: datastore_name:
description: description:
- Name of Datastore to use to create a new instance - Name of Datastore to use to create a new instance.
version_added: '0.2.0' version_added: '0.2.0'
type: str type: str
updateconf: updateconf:
description: description:
- When O(instance_ids) is provided, updates running VMs with the C(updateconf) API call. - When O(instance_ids) is provided, updates running VMs with the C(updateconf) API call.
- When new VMs are being created, emulates the C(updateconf) API call via direct template merge. - When new VMs are being created, emulates the C(updateconf) API call using direct template merge.
- Allows for complete modifications of the C(CONTEXT) attribute. - Allows for complete modifications of the C(CONTEXT) attribute.
type: dict type: dict
version_added: 6.3.0 version_added: 6.3.0
author: author:
- "Milan Ilic (@ilicmilan)" - "Milan Ilic (@ilicmilan)"
- "Jan Meerkamp (@meerkampdvv)" - "Jan Meerkamp (@meerkampdvv)"
''' """
EXAMPLES = ''' EXAMPLES = r"""
- name: Create a new instance - name: Create a new instance
community.general.one_vm: community.general.one_vm:
template_id: 90 template_id: 90
@ -441,78 +423,78 @@ EXAMPLES = '''
SSH_PUBLIC_KEY: |- SSH_PUBLIC_KEY: |-
ssh-rsa ... ssh-rsa ...
ssh-ed25519 ... ssh-ed25519 ...
''' """
RETURN = ''' RETURN = r"""
instances_ids: instances_ids:
description: a list of instances ids whose state is changed or which are fetched with O(instance_ids) option. description: A list of instances ids whose state is changed or which are fetched with O(instance_ids) option.
type: list type: list
returned: success returned: success
sample: [ 1234, 1235 ] sample: [1234, 1235]
instances: instances:
description: a list of instances info whose state is changed or which are fetched with O(instance_ids) option. description: A list of instances info whose state is changed or which are fetched with O(instance_ids) option.
type: complex type: complex
returned: success returned: success
contains: contains:
vm_id: vm_id:
description: vm id description: Vm id.
type: int type: int
sample: 153 sample: 153
vm_name: vm_name:
description: vm name description: Vm name.
type: str type: str
sample: foo sample: foo
template_id: template_id:
description: vm's template id description: Vm's template id.
type: int type: int
sample: 153 sample: 153
group_id: group_id:
description: vm's group id description: Vm's group id.
type: int type: int
sample: 1 sample: 1
group_name: group_name:
description: vm's group name description: Vm's group name.
type: str type: str
sample: one-users sample: one-users
owner_id: owner_id:
description: vm's owner id description: Vm's owner id.
type: int type: int
sample: 143 sample: 143
owner_name: owner_name:
description: vm's owner name description: Vm's owner name.
type: str type: str
sample: app-user sample: app-user
mode: mode:
description: vm's mode description: Vm's mode.
type: str type: str
returned: success returned: success
sample: 660 sample: 660
state: state:
description: state of an instance description: State of an instance.
type: str type: str
sample: ACTIVE sample: ACTIVE
lcm_state: lcm_state:
description: lcm state of an instance that is only relevant when the state is ACTIVE description: Lcm state of an instance that is only relevant when the state is ACTIVE.
type: str type: str
sample: RUNNING sample: RUNNING
cpu: cpu:
description: Percentage of CPU divided by 100 description: Percentage of CPU divided by 100.
type: float type: float
sample: 0.2 sample: 0.2
vcpu: vcpu:
description: Number of CPUs (cores) description: Number of CPUs (cores).
type: int type: int
sample: 2 sample: 2
memory: memory:
description: The size of the memory in MB description: The size of the memory in MB.
type: str type: str
sample: 4096 MB sample: 4096 MB
disk_size: disk_size:
description: The size of the disk in MB description: The size of the disk in MB.
type: str type: str
sample: 20480 MB sample: 20480 MB
networks: networks:
description: a list of dictionaries with info about IP, NAME, MAC, SECURITY_GROUPS for each NIC description: A list of dictionaries with info about IP, NAME, MAC, SECURITY_GROUPS for each NIC.
type: list type: list
sample: [ sample: [
{ {
@ -529,18 +511,15 @@ instances:
} }
] ]
uptime_h: uptime_h:
description: Uptime of the instance in hours description: Uptime of the instance in hours.
type: int type: int
sample: 35 sample: 35
labels: labels:
description: A list of string labels that are associated with the instance description: A list of string labels that are associated with the instance.
type: list type: list
sample: [ sample: ["foo", "spec-label"]
"foo",
"spec-label"
]
attributes: attributes:
description: A dictionary of key/values attributes that are associated with the instance description: A dictionary of key/values attributes that are associated with the instance.
type: dict type: dict
sample: { sample: {
"HYPERVISOR": "kvm", "HYPERVISOR": "kvm",
@ -561,74 +540,69 @@ instances:
} }
tagged_instances: tagged_instances:
description: description:
- A list of instances info based on a specific attributes and/or - A list of instances info based on a specific attributes and/or labels that are specified with O(count_attributes) and O(count_labels) options.
- labels that are specified with O(count_attributes) and O(count_labels)
- options.
type: complex type: complex
returned: success returned: success
contains: contains:
vm_id: vm_id:
description: vm id description: Vm id.
type: int type: int
sample: 153 sample: 153
vm_name: vm_name:
description: vm name description: Vm name.
type: str type: str
sample: foo sample: foo
template_id: template_id:
description: vm's template id description: Vm's template id.
type: int type: int
sample: 153 sample: 153
group_id: group_id:
description: vm's group id description: Vm's group id.
type: int type: int
sample: 1 sample: 1
group_name: group_name:
description: vm's group name description: Vm's group name.
type: str type: str
sample: one-users sample: one-users
owner_id: owner_id:
description: vm's user id description: Vm's user id.
type: int type: int
sample: 143 sample: 143
owner_name: owner_name:
description: vm's user name description: Vm's user name.
type: str type: str
sample: app-user sample: app-user
mode: mode:
description: vm's mode description: Vm's mode.
type: str type: str
returned: success returned: success
sample: 660 sample: 660
state: state:
description: state of an instance description: State of an instance.
type: str type: str
sample: ACTIVE sample: ACTIVE
lcm_state: lcm_state:
description: lcm state of an instance that is only relevant when the state is ACTIVE description: Lcm state of an instance that is only relevant when the state is ACTIVE.
type: str type: str
sample: RUNNING sample: RUNNING
cpu: cpu:
description: Percentage of CPU divided by 100 description: Percentage of CPU divided by 100.
type: float type: float
sample: 0.2 sample: 0.2
vcpu: vcpu:
description: Number of CPUs (cores) description: Number of CPUs (cores).
type: int type: int
sample: 2 sample: 2
memory: memory:
description: The size of the memory in MB description: The size of the memory in MB.
type: str type: str
sample: 4096 MB sample: 4096 MB
disk_size: disk_size:
description: The size of the disk in MB description: The size of the disk in MB.
type: list type: list
sample: [ sample: ["20480 MB", "10240 MB"]
"20480 MB",
"10240 MB"
]
networks: networks:
description: a list of dictionaries with info about IP, NAME, MAC, SECURITY_GROUPS for each NIC description: A list of dictionaries with info about IP, NAME, MAC, SECURITY_GROUPS for each NIC.
type: list type: list
sample: [ sample: [
{ {
@ -645,37 +619,23 @@ tagged_instances:
} }
] ]
uptime_h: uptime_h:
description: Uptime of the instance in hours description: Uptime of the instance in hours.
type: int type: int
sample: 35 sample: 35
labels: labels:
description: A list of string labels that are associated with the instance description: A list of string labels that are associated with the instance.
type: list type: list
sample: [ sample: ["foo", "spec-label"]
"foo",
"spec-label"
]
attributes: attributes:
description: A dictionary of key/values attributes that are associated with the instance description: A dictionary of key/values attributes that are associated with the instance.
type: dict type: dict
sample: { sample: {"HYPERVISOR": "kvm", "LOGO": "images/logos/centos.png", "TE_GALAXY": "bar", "USER_INPUTS": null}
"HYPERVISOR": "kvm",
"LOGO": "images/logos/centos.png",
"TE_GALAXY": "bar",
"USER_INPUTS": null
}
updateconf: updateconf:
description: A dictionary of key/values attributes that are set with the updateconf API call description: A dictionary of key/values attributes that are set with the updateconf API call.
type: dict type: dict
version_added: 6.3.0 version_added: 6.3.0
sample: { sample: {"OS": {"ARCH": "x86_64"}, "CONTEXT": {"START_SCRIPT": "ip r r 169.254.16.86/32 dev eth0", "SSH_PUBLIC_KEY": "ssh-rsa ...\\nssh-ed25519 ..."}}
"OS": { "ARCH": "x86_64" }, """
"CONTEXT": {
"START_SCRIPT": "ip r r 169.254.16.86/32 dev eth0",
"SSH_PUBLIC_KEY": "ssh-rsa ...\\nssh-ed25519 ..."
}
}
'''
try: try:
import pyone import pyone

View File

@ -9,8 +9,7 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: one_vnet module: one_vnet
short_description: Manages OpenNebula virtual networks short_description: Manages OpenNebula virtual networks
version_added: 9.4.0 version_added: 9.4.0
@ -34,9 +33,8 @@ options:
type: int type: int
name: name:
description: description:
- A O(name) of the network you would like to manage. If a network with - A O(name) of the network you would like to manage. If a network with the given name does not exist it will be created, otherwise it will
the given name does not exist it will be created, otherwise it will be be managed by this module.
managed by this module.
type: str type: str
template: template:
description: description:
@ -53,9 +51,9 @@ options:
extends_documentation_fragment: extends_documentation_fragment:
- community.general.opennebula - community.general.opennebula
- community.general.attributes - community.general.attributes
''' """
EXAMPLES = ''' EXAMPLES = r"""
- name: Make sure the network is present by ID - name: Make sure the network is present by ID
community.general.one_vnet: community.general.one_vnet:
id: 0 id: 0
@ -87,9 +85,9 @@ EXAMPLES = '''
community.general.one_vnet: community.general.one_vnet:
id: 0 id: 0
state: absent state: absent
''' """
RETURN = ''' RETURN = r"""
id: id:
description: The network id. description: The network id.
type: int type: int
@ -180,7 +178,7 @@ permissions:
type: str type: str
sample: 0 sample: 0
other_a: other_a:
description: The network's other users ADMIN permissions description: The network's other users ADMIN permissions.
type: str type: str
sample: 0 sample: 0
sample: sample:
@ -254,7 +252,7 @@ ar_pool:
mac: 5d:9b:c0:9e:f6:e5 mac: 5d:9b:c0:9e:f6:e5
size: 20 size: 20
type: IP4 type: IP4
''' """
from ansible_collections.community.general.plugins.module_utils.opennebula import OpenNebulaModule from ansible_collections.community.general.plugins.module_utils.opennebula import OpenNebulaModule

View File

@ -7,13 +7,11 @@
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: oneandone_firewall_policy module: oneandone_firewall_policy
short_description: Configure 1&1 firewall policy short_description: Configure 1&1 firewall policy
description: description:
- Create, remove, reconfigure, update firewall policies. - Create, remove, reconfigure, update firewall policies. This module has a dependency on 1and1 >= 1.0.
This module has a dependency on 1and1 >= 1.0.
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
attributes: attributes:
@ -28,21 +26,19 @@ options:
required: false required: false
type: str type: str
default: 'present' default: 'present'
choices: [ "present", "absent", "update" ] choices: ["present", "absent", "update"]
auth_token: auth_token:
description: description:
- Authenticating API token provided by 1&1. - Authenticating API token provided by 1&1.
type: str type: str
api_url: api_url:
description: description:
- Custom API URL. Overrides the - Custom API URL. Overrides the E(ONEANDONE_API_URL) environment variable.
ONEANDONE_API_URL environment variable.
type: str type: str
required: false required: false
name: name:
description: description:
- Firewall policy name used with present state. Used as identifier (id or name) when used with absent state. - Firewall policy name used with present state. Used as identifier (id or name) when used with absent state. maxLength=128.
maxLength=128
type: str type: str
firewall_policy: firewall_policy:
description: description:
@ -50,16 +46,14 @@ options:
type: str type: str
rules: rules:
description: description:
- A list of rules that will be set for the firewall policy. - A list of rules that will be set for the firewall policy. Each rule must contain protocol parameter, in addition to three optional parameters
Each rule must contain protocol parameter, in addition to three optional parameters (port_from, port_to, and source).
(port_from, port_to, and source)
type: list type: list
elements: dict elements: dict
default: [] default: []
add_server_ips: add_server_ips:
description: description:
- A list of server identifiers (id or name) to be assigned to a firewall policy. - A list of server identifiers (id or name) to be assigned to a firewall policy. Used in combination with update state.
Used in combination with update state.
type: list type: list
elements: str elements: str
required: false required: false
@ -73,8 +67,8 @@ options:
default: [] default: []
add_rules: add_rules:
description: description:
- A list of rules that will be added to an existing firewall policy. - A list of rules that will be added to an existing firewall policy. It is syntax is the same as the one used for rules parameter. Used
It is syntax is the same as the one used for rules parameter. Used in combination with update state. in combination with update state.
type: list type: list
elements: dict elements: dict
required: false required: false
@ -88,23 +82,23 @@ options:
default: [] default: []
description: description:
description: description:
- Firewall policy description. maxLength=256 - Firewall policy description. maxLength=256.
type: str type: str
required: false required: false
wait: wait:
description: description:
- wait for the instance to be in state 'running' before returning - Wait for the instance to be in state 'running' before returning.
required: false required: false
default: true default: true
type: bool type: bool
wait_timeout: wait_timeout:
description: description:
- how long before wait gives up, in seconds - How long before wait gives up, in seconds.
type: int type: int
default: 600 default: 600
wait_interval: wait_interval:
description: description:
- Defines the number of seconds to wait when using the _wait_for methods - Defines the number of seconds to wait when using the _wait_for methods.
type: int type: int
default: 5 default: 5
@ -114,17 +108,16 @@ requirements:
author: author:
- "Amel Ajdinovic (@aajdinov)" - "Amel Ajdinovic (@aajdinov)"
- "Ethan Devenport (@edevenport)" - "Ethan Devenport (@edevenport)"
''' """
EXAMPLES = ''' EXAMPLES = r"""
- name: Create a firewall policy - name: Create a firewall policy
community.general.oneandone_firewall_policy: community.general.oneandone_firewall_policy:
auth_token: oneandone_private_api_key auth_token: oneandone_private_api_key
name: ansible-firewall-policy name: ansible-firewall-policy
description: Testing creation of firewall policies with ansible description: Testing creation of firewall policies with ansible
rules: rules:
- - protocol: TCP
protocol: TCP
port_from: 80 port_from: 80
port_to: 80 port_to: 80
source: 0.0.0.0 source: 0.0.0.0
@ -172,13 +165,11 @@ EXAMPLES = '''
firewall_policy: ansible-firewall-policy-updated firewall_policy: ansible-firewall-policy-updated
description: Adding rules to an existing firewall policy description: Adding rules to an existing firewall policy
add_rules: add_rules:
- - protocol: TCP
protocol: TCP
port_from: 70 port_from: 70
port_to: 70 port_to: 70
source: 0.0.0.0 source: 0.0.0.0
- - protocol: TCP
protocol: TCP
port_from: 60 port_from: 60
port_to: 60 port_to: 60
source: 0.0.0.0 source: 0.0.0.0
@ -193,19 +184,19 @@ EXAMPLES = '''
remove_rules: remove_rules:
- rule_id #1 - rule_id #1
- rule_id #2 - rule_id #2
- ... - '...'
wait: true wait: true
wait_timeout: 500 wait_timeout: 500
state: update state: update
''' """
RETURN = ''' RETURN = r"""
firewall_policy: firewall_policy:
description: Information about the firewall policy that was processed description: Information about the firewall policy that was processed.
type: dict type: dict
sample: '{"id": "92B74394A397ECC3359825C1656D67A6", "name": "Default Policy"}' sample: '{"id": "92B74394A397ECC3359825C1656D67A6", "name": "Default Policy"}'
returned: always returned: always
''' """
import os import os
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule

View File

@ -7,13 +7,11 @@
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: oneandone_load_balancer module: oneandone_load_balancer
short_description: Configure 1&1 load balancer short_description: Configure 1&1 load balancer
description: description:
- Create, remove, update load balancers. - Create, remove, update load balancers. This module has a dependency on 1and1 >= 1.0.
This module has a dependency on 1and1 >= 1.0.
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
attributes: attributes:
@ -28,7 +26,7 @@ options:
type: str type: str
required: false required: false
default: 'present' default: 'present'
choices: [ "present", "absent", "update" ] choices: ["present", "absent", "update"]
auth_token: auth_token:
description: description:
- Authenticating API token provided by 1&1. - Authenticating API token provided by 1&1.
@ -39,32 +37,30 @@ options:
type: str type: str
api_url: api_url:
description: description:
- Custom API URL. Overrides the - Custom API URL. Overrides the E(ONEANDONE_API_URL) environment variable.
E(ONEANDONE_API_URL) environment variable.
type: str type: str
required: false required: false
name: name:
description: description:
- Load balancer name used with present state. Used as identifier (id or name) when used with absent state. - Load balancer name used with present state. Used as identifier (id or name) when used with absent state. maxLength=128.
maxLength=128
type: str type: str
health_check_test: health_check_test:
description: description:
- Type of the health check. At the moment, HTTP is not allowed. - Type of the health check. At the moment, HTTP is not allowed.
type: str type: str
choices: [ "NONE", "TCP", "HTTP", "ICMP" ] choices: ["NONE", "TCP", "HTTP", "ICMP"]
health_check_interval: health_check_interval:
description: description:
- Health check period in seconds. minimum=5, maximum=300, multipleOf=1 - Health check period in seconds. minimum=5, maximum=300, multipleOf=1.
type: str type: str
health_check_path: health_check_path:
description: description:
- Url to call for checking. Required for HTTP health check. maxLength=1000 - Url to call for checking. Required for HTTP health check. maxLength=1000.
type: str type: str
required: false required: false
health_check_parse: health_check_parse:
description: description:
- Regular expression to check. Required for HTTP health check. maxLength=64 - Regular expression to check. Required for HTTP health check. maxLength=64.
type: str type: str
required: false required: false
persistence: persistence:
@ -73,36 +69,35 @@ options:
type: bool type: bool
persistence_time: persistence_time:
description: description:
- Persistence time in seconds. Required if persistence is enabled. minimum=30, maximum=1200, multipleOf=1 - Persistence time in seconds. Required if persistence is enabled. minimum=30, maximum=1200, multipleOf=1.
type: str type: str
method: method:
description: description:
- Balancing procedure. - Balancing procedure.
type: str type: str
choices: [ "ROUND_ROBIN", "LEAST_CONNECTIONS" ] choices: ["ROUND_ROBIN", "LEAST_CONNECTIONS"]
datacenter: datacenter:
description: description:
- ID or country code of the datacenter where the load balancer will be created. - ID or country code of the datacenter where the load balancer will be created.
- If not specified, it defaults to V(US). - If not specified, it defaults to V(US).
type: str type: str
choices: [ "US", "ES", "DE", "GB" ] choices: ["US", "ES", "DE", "GB"]
required: false required: false
rules: rules:
description: description:
- A list of rule objects that will be set for the load balancer. Each rule must contain protocol, - A list of rule objects that will be set for the load balancer. Each rule must contain protocol, port_balancer, and port_server parameters,
port_balancer, and port_server parameters, in addition to source parameter, which is optional. in addition to source parameter, which is optional.
type: list type: list
elements: dict elements: dict
default: [] default: []
description: description:
description: description:
- Description of the load balancer. maxLength=256 - Description of the load balancer. maxLength=256.
type: str type: str
required: false required: false
add_server_ips: add_server_ips:
description: description:
- A list of server identifiers (id or name) to be assigned to a load balancer. - A list of server identifiers (id or name) to be assigned to a load balancer. Used in combination with update state.
Used in combination with update state.
type: list type: list
elements: str elements: str
required: false required: false
@ -116,8 +111,8 @@ options:
default: [] default: []
add_rules: add_rules:
description: description:
- A list of rules that will be added to an existing load balancer. - A list of rules that will be added to an existing load balancer. It is syntax is the same as the one used for rules parameter. Used in
It is syntax is the same as the one used for rules parameter. Used in combination with update state. combination with update state.
type: list type: list
elements: dict elements: dict
required: false required: false
@ -131,18 +126,18 @@ options:
default: [] default: []
wait: wait:
description: description:
- wait for the instance to be in state 'running' before returning - Wait for the instance to be in state 'running' before returning.
required: false required: false
default: true default: true
type: bool type: bool
wait_timeout: wait_timeout:
description: description:
- how long before wait gives up, in seconds - How long before wait gives up, in seconds.
type: int type: int
default: 600 default: 600
wait_interval: wait_interval:
description: description:
- Defines the number of seconds to wait when using the _wait_for methods - Defines the number of seconds to wait when using the _wait_for methods.
type: int type: int
default: 5 default: 5
@ -152,9 +147,9 @@ requirements:
author: author:
- Amel Ajdinovic (@aajdinov) - Amel Ajdinovic (@aajdinov)
- Ethan Devenport (@edevenport) - Ethan Devenport (@edevenport)
''' """
EXAMPLES = ''' EXAMPLES = r"""
- name: Create a load balancer - name: Create a load balancer
community.general.oneandone_load_balancer: community.general.oneandone_load_balancer:
auth_token: oneandone_private_api_key auth_token: oneandone_private_api_key
@ -167,8 +162,7 @@ EXAMPLES = '''
method: ROUND_ROBIN method: ROUND_ROBIN
datacenter: US datacenter: US
rules: rules:
- - protocol: TCP
protocol: TCP
port_balancer: 80 port_balancer: 80
port_server: 80 port_server: 80
source: 0.0.0.0 source: 0.0.0.0
@ -221,13 +215,11 @@ EXAMPLES = '''
load_balancer: ansible load balancer updated load_balancer: ansible load balancer updated
description: Adding rules to a load balancer with ansible description: Adding rules to a load balancer with ansible
add_rules: add_rules:
- - protocol: TCP
protocol: TCP
port_balancer: 70 port_balancer: 70
port_server: 70 port_server: 70
source: 0.0.0.0 source: 0.0.0.0
- - protocol: TCP
protocol: TCP
port_balancer: 60 port_balancer: 60
port_server: 60 port_server: 60
source: 0.0.0.0 source: 0.0.0.0
@ -243,19 +235,19 @@ EXAMPLES = '''
remove_rules: remove_rules:
- rule_id #1 - rule_id #1
- rule_id #2 - rule_id #2
- ... - '...'
wait: true wait: true
wait_timeout: 500 wait_timeout: 500
state: update state: update
''' """
RETURN = ''' RETURN = r"""
load_balancer: load_balancer:
description: Information about the load balancer that was processed description: Information about the load balancer that was processed.
type: dict type: dict
sample: '{"id": "92B74394A397ECC3359825C1656D67A6", "name": "Default Balancer"}' sample: '{"id": "92B74394A397ECC3359825C1656D67A6", "name": "Default Balancer"}'
returned: always returned: always
''' """
import os import os
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule

View File

@ -7,14 +7,11 @@
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: oneandone_monitoring_policy module: oneandone_monitoring_policy
short_description: Configure 1&1 monitoring policy short_description: Configure 1&1 monitoring policy
description: description:
- Create, remove, update monitoring policies - Create, remove, update monitoring policies (and add/remove ports, processes, and servers). This module has a dependency on 1and1 >= 1.0.
(and add/remove ports, processes, and servers).
This module has a dependency on 1and1 >= 1.0.
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
attributes: attributes:
@ -29,20 +26,19 @@ options:
type: str type: str
required: false required: false
default: present default: present
choices: [ "present", "absent", "update" ] choices: ["present", "absent", "update"]
auth_token: auth_token:
description: description:
- Authenticating API token provided by 1&1. - Authenticating API token provided by 1&1.
type: str type: str
api_url: api_url:
description: description:
- Custom API URL. Overrides the - Custom API URL. Overrides the E(ONEANDONE_API_URL) environment variable.
ONEANDONE_API_URL environment variable.
type: str type: str
required: false required: false
name: name:
description: description:
- Monitoring policy name used with present state. Used as identifier (id or name) when used with absent state. maxLength=128 - Monitoring policy name used with present state. Used as identifier (id or name) when used with absent state. maxLength=128.
type: str type: str
monitoring_policy: monitoring_policy:
description: description:
@ -54,19 +50,18 @@ options:
type: str type: str
email: email:
description: description:
- User's email. maxLength=128 - User's email. maxLength=128.
type: str type: str
description: description:
description: description:
- Monitoring policy description. maxLength=256 - Monitoring policy description. maxLength=256.
type: str type: str
required: false required: false
thresholds: thresholds:
description: description:
- Monitoring policy thresholds. Each of the suboptions have warning and critical, - Monitoring policy thresholds. Each of the suboptions have warning and critical, which both have alert and value suboptions. Warning is
which both have alert and value suboptions. Warning is used to set limits for used to set limits for warning alerts, critical is used to set critical alerts. alert enables alert, and value is used to advise when
warning alerts, critical is used to set critical alerts. alert enables alert, the value is exceeded.
and value is used to advise when the value is exceeded.
type: list type: list
elements: dict elements: dict
default: [] default: []
@ -101,16 +96,16 @@ options:
protocol: protocol:
description: description:
- Internet protocol. - Internet protocol.
choices: [ "TCP", "UDP" ] choices: ["TCP", "UDP"]
required: true required: true
port: port:
description: description:
- Port number. minimum=1, maximum=65535 - Port number. minimum=1, maximum=65535.
required: true required: true
alert_if: alert_if:
description: description:
- Case of alert. - Case of alert.
choices: [ "RESPONDING", "NOT_RESPONDING" ] choices: ["RESPONDING", "NOT_RESPONDING"]
required: true required: true
email_notification: email_notification:
description: description:
@ -125,12 +120,12 @@ options:
suboptions: suboptions:
process: process:
description: description:
- Name of the process. maxLength=50 - Name of the process. maxLength=50.
required: true required: true
alert_if: alert_if:
description: description:
- Case of alert. - Case of alert.
choices: [ "RUNNING", "NOT_RUNNING" ] choices: ["RUNNING", "NOT_RUNNING"]
required: true required: true
add_ports: add_ports:
description: description:
@ -190,18 +185,18 @@ options:
default: [] default: []
wait: wait:
description: description:
- wait for the instance to be in state 'running' before returning - Wait for the instance to be in state 'running' before returning.
required: false required: false
default: true default: true
type: bool type: bool
wait_timeout: wait_timeout:
description: description:
- how long before wait gives up, in seconds - How long before wait gives up, in seconds.
type: int type: int
default: 600 default: 600
wait_interval: wait_interval:
description: description:
- Defines the number of seconds to wait when using the _wait_for methods - Defines the number of seconds to wait when using the _wait_for methods.
type: int type: int
default: 5 default: 5
@ -211,9 +206,9 @@ requirements:
author: author:
- "Amel Ajdinovic (@aajdinov)" - "Amel Ajdinovic (@aajdinov)"
- "Ethan Devenport (@edevenport)" - "Ethan Devenport (@edevenport)"
''' """
EXAMPLES = ''' EXAMPLES = r"""
- name: Create a monitoring policy - name: Create a monitoring policy
community.general.oneandone_monitoring_policy: community.general.oneandone_monitoring_policy:
auth_token: oneandone_private_api_key auth_token: oneandone_private_api_key
@ -222,40 +217,35 @@ EXAMPLES = '''
email: your@emailaddress.com email: your@emailaddress.com
agent: true agent: true
thresholds: thresholds:
- - cpu:
cpu:
warning: warning:
value: 80 value: 80
alert: false alert: false
critical: critical:
value: 92 value: 92
alert: false alert: false
- - ram:
ram:
warning: warning:
value: 80 value: 80
alert: false alert: false
critical: critical:
value: 90 value: 90
alert: false alert: false
- - disk:
disk:
warning: warning:
value: 80 value: 80
alert: false alert: false
critical: critical:
value: 90 value: 90
alert: false alert: false
- - internal_ping:
internal_ping:
warning: warning:
value: 50 value: 50
alert: false alert: false
critical: critical:
value: 100 value: 100
alert: false alert: false
- - transfer:
transfer:
warning: warning:
value: 1000 value: 1000
alert: false alert: false
@ -263,14 +253,12 @@ EXAMPLES = '''
value: 2000 value: 2000
alert: false alert: false
ports: ports:
- - protocol: TCP
protocol: TCP
port: 22 port: 22
alert_if: RESPONDING alert_if: RESPONDING
email_notification: false email_notification: false
processes: processes:
- - process: test
process: test
alert_if: NOT_RUNNING alert_if: NOT_RUNNING
email_notification: false email_notification: false
wait: true wait: true
@ -289,40 +277,35 @@ EXAMPLES = '''
description: Testing creation of a monitoring policy with ansible updated description: Testing creation of a monitoring policy with ansible updated
email: another@emailaddress.com email: another@emailaddress.com
thresholds: thresholds:
- - cpu:
cpu:
warning: warning:
value: 70 value: 70
alert: false alert: false
critical: critical:
value: 90 value: 90
alert: false alert: false
- - ram:
ram:
warning: warning:
value: 70 value: 70
alert: false alert: false
critical: critical:
value: 80 value: 80
alert: false alert: false
- - disk:
disk:
warning: warning:
value: 70 value: 70
alert: false alert: false
critical: critical:
value: 80 value: 80
alert: false alert: false
- - internal_ping:
internal_ping:
warning: warning:
value: 60 value: 60
alert: false alert: false
critical: critical:
value: 90 value: 90
alert: false alert: false
- - transfer:
transfer:
warning: warning:
value: 900 value: 900
alert: false alert: false
@ -337,8 +320,7 @@ EXAMPLES = '''
auth_token: oneandone_private_api_key auth_token: oneandone_private_api_key
monitoring_policy: ansible monitoring policy updated monitoring_policy: ansible monitoring policy updated
add_ports: add_ports:
- - protocol: TCP
protocol: TCP
port: 33 port: 33
alert_if: RESPONDING alert_if: RESPONDING
email_notification: false email_notification: false
@ -350,14 +332,12 @@ EXAMPLES = '''
auth_token: oneandone_private_api_key auth_token: oneandone_private_api_key
monitoring_policy: ansible monitoring policy updated monitoring_policy: ansible monitoring policy updated
update_ports: update_ports:
- - id: existing_port_id
id: existing_port_id
protocol: TCP protocol: TCP
port: 34 port: 34
alert_if: RESPONDING alert_if: RESPONDING
email_notification: false email_notification: false
- - id: existing_port_id
id: existing_port_id
protocol: TCP protocol: TCP
port: 23 port: 23
alert_if: RESPONDING alert_if: RESPONDING
@ -378,8 +358,7 @@ EXAMPLES = '''
auth_token: oneandone_private_api_key auth_token: oneandone_private_api_key
monitoring_policy: ansible monitoring policy updated monitoring_policy: ansible monitoring policy updated
add_processes: add_processes:
- - process: test_2
process: test_2
alert_if: NOT_RUNNING alert_if: NOT_RUNNING
email_notification: false email_notification: false
wait: true wait: true
@ -390,13 +369,11 @@ EXAMPLES = '''
auth_token: oneandone_private_api_key auth_token: oneandone_private_api_key
monitoring_policy: ansible monitoring policy updated monitoring_policy: ansible monitoring policy updated
update_processes: update_processes:
- - id: process_id
id: process_id
process: test_1 process: test_1
alert_if: NOT_RUNNING alert_if: NOT_RUNNING
email_notification: false email_notification: false
- - id: process_id
id: process_id
process: test_3 process: test_3
alert_if: NOT_RUNNING alert_if: NOT_RUNNING
email_notification: false email_notification: false
@ -429,15 +406,15 @@ EXAMPLES = '''
- server01 - server01
wait: true wait: true
state: update state: update
''' """
RETURN = ''' RETURN = r"""
monitoring_policy: monitoring_policy:
description: Information about the monitoring policy that was processed description: Information about the monitoring policy that was processed.
type: dict type: dict
sample: '{"id": "92B74394A397ECC3359825C1656D67A6", "name": "Default Policy"}' sample: '{"id": "92B74394A397ECC3359825C1656D67A6", "name": "Default Policy"}'
returned: always returned: always
''' """
import os import os
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule

View File

@ -7,13 +7,11 @@
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: oneandone_private_network module: oneandone_private_network
short_description: Configure 1&1 private networking short_description: Configure 1&1 private networking
description: description:
- Create, remove, reconfigure, update a private network. - Create, remove, reconfigure, update a private network. This module has a dependency on 1and1 >= 1.0.
This module has a dependency on 1and1 >= 1.0.
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
attributes: attributes:
@ -28,7 +26,7 @@ options:
type: str type: str
required: false required: false
default: 'present' default: 'present'
choices: [ "present", "absent", "update" ] choices: ["present", "absent", "update"]
auth_token: auth_token:
description: description:
- Authenticating API token provided by 1&1. - Authenticating API token provided by 1&1.
@ -39,8 +37,7 @@ options:
type: str type: str
api_url: api_url:
description: description:
- Custom API URL. Overrides the - Custom API URL. Overrides the E(ONEANDONE_API_URL) environment variable.
ONEANDONE_API_URL environment variable.
type: str type: str
required: false required: false
name: name:
@ -53,16 +50,16 @@ options:
type: str type: str
datacenter: datacenter:
description: description:
- The identifier of the datacenter where the private network will be created - The identifier of the datacenter where the private network will be created.
type: str type: str
choices: [US, ES, DE, GB] choices: [US, ES, DE, GB]
network_address: network_address:
description: description:
- Set a private network space, i.e. 192.168.1.0 - Set a private network space, for example V(192.168.1.0).
type: str type: str
subnet_mask: subnet_mask:
description: description:
- Set the netmask for the private network, i.e. 255.255.255.0 - Set the netmask for the private network, for example V(255.255.255.0).
type: str type: str
add_members: add_members:
description: description:
@ -78,18 +75,18 @@ options:
default: [] default: []
wait: wait:
description: description:
- wait for the instance to be in state 'running' before returning - Wait for the instance to be in state 'running' before returning.
required: false required: false
default: true default: true
type: bool type: bool
wait_timeout: wait_timeout:
description: description:
- how long before wait gives up, in seconds - How long before wait gives up, in seconds.
type: int type: int
default: 600 default: 600
wait_interval: wait_interval:
description: description:
- Defines the number of seconds to wait when using the _wait_for methods - Defines the number of seconds to wait when using the _wait_for methods.
type: int type: int
default: 5 default: 5
@ -99,9 +96,9 @@ requirements:
author: author:
- Amel Ajdinovic (@aajdinov) - Amel Ajdinovic (@aajdinov)
- Ethan Devenport (@edevenport) - Ethan Devenport (@edevenport)
''' """
EXAMPLES = ''' EXAMPLES = r"""
- name: Create a private network - name: Create a private network
community.general.oneandone_private_network: community.general.oneandone_private_network:
auth_token: oneandone_private_api_key auth_token: oneandone_private_api_key
@ -140,15 +137,15 @@ EXAMPLES = '''
private_network: backup_network private_network: backup_network
remove_members: remove_members:
- server identifier (id or name) - server identifier (id or name)
''' """
RETURN = ''' RETURN = r"""
private_network: private_network:
description: Information about the private network. description: Information about the private network.
type: dict type: dict
sample: '{"name": "backup_network", "id": "55726DEDA20C99CF6F2AF8F18CAC9963"}' sample: '{"name": "backup_network", "id": "55726DEDA20C99CF6F2AF8F18CAC9963"}'
returned: always returned: always
''' """
import os import os
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule

View File

@ -7,13 +7,11 @@
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: oneandone_public_ip module: oneandone_public_ip
short_description: Configure 1&1 public IPs short_description: Configure 1&1 public IPs
description: description:
- Create, update, and remove public IPs. - Create, update, and remove public IPs. This module has a dependency on 1and1 >= 1.0.
This module has a dependency on 1and1 >= 1.0.
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
attributes: attributes:
@ -28,20 +26,19 @@ options:
type: str type: str
required: false required: false
default: 'present' default: 'present'
choices: [ "present", "absent", "update" ] choices: ["present", "absent", "update"]
auth_token: auth_token:
description: description:
- Authenticating API token provided by 1&1. - Authenticating API token provided by 1&1.
type: str type: str
api_url: api_url:
description: description:
- Custom API URL. Overrides the - Custom API URL. Overrides the E(ONEANDONE_API_URL) environment variable.
ONEANDONE_API_URL environment variable.
type: str type: str
required: false required: false
reverse_dns: reverse_dns:
description: description:
- Reverse DNS name. maxLength=256 - Reverse DNS name. maxLength=256.
type: str type: str
required: false required: false
datacenter: datacenter:
@ -64,18 +61,18 @@ options:
type: str type: str
wait: wait:
description: description:
- wait for the instance to be in state 'running' before returning - Wait for the instance to be in state 'running' before returning.
required: false required: false
default: true default: true
type: bool type: bool
wait_timeout: wait_timeout:
description: description:
- how long before wait gives up, in seconds - How long before wait gives up, in seconds.
type: int type: int
default: 600 default: 600
wait_interval: wait_interval:
description: description:
- Defines the number of seconds to wait when using the _wait_for methods - Defines the number of seconds to wait when using the _wait_for methods.
type: int type: int
default: 5 default: 5
@ -85,9 +82,9 @@ requirements:
author: author:
- Amel Ajdinovic (@aajdinov) - Amel Ajdinovic (@aajdinov)
- Ethan Devenport (@edevenport) - Ethan Devenport (@edevenport)
''' """
EXAMPLES = ''' EXAMPLES = r"""
- name: Create a public IP - name: Create a public IP
community.general.oneandone_public_ip: community.general.oneandone_public_ip:
auth_token: oneandone_private_api_key auth_token: oneandone_private_api_key
@ -107,15 +104,15 @@ EXAMPLES = '''
auth_token: oneandone_private_api_key auth_token: oneandone_private_api_key
public_ip_id: public ip id public_ip_id: public ip id
state: absent state: absent
''' """
RETURN = ''' RETURN = r"""
public_ip: public_ip:
description: Information about the public ip that was processed description: Information about the public ip that was processed.
type: dict type: dict
sample: '{"id": "F77CC589EBC120905B4F4719217BFF6D", "ip": "10.5.132.106"}' sample: '{"id": "F77CC589EBC120905B4F4719217BFF6D", "ip": "10.5.132.106"}'
returned: always returned: always
''' """
import os import os
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule

View File

@ -7,13 +7,12 @@
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: oneandone_server module: oneandone_server
short_description: Create, destroy, start, stop, and reboot a 1&1 Host server short_description: Create, destroy, start, stop, and reboot a 1&1 Host server
description: description:
- Create, destroy, update, start, stop, and reboot a 1&1 Host server. - Create, destroy, update, start, stop, and reboot a 1&1 Host server. When the server is created it can optionally wait for it to be 'running'
When the server is created it can optionally wait for it to be 'running' before returning. before returning.
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
attributes: attributes:
@ -27,23 +26,21 @@ options:
- Define a server's state to create, remove, start or stop it. - Define a server's state to create, remove, start or stop it.
type: str type: str
default: present default: present
choices: [ "present", "absent", "running", "stopped" ] choices: ["present", "absent", "running", "stopped"]
auth_token: auth_token:
description: description:
- Authenticating API token provided by 1&1. Overrides the - Authenticating API token provided by 1&1. Overrides the E(ONEANDONE_AUTH_TOKEN) environment variable.
ONEANDONE_AUTH_TOKEN environment variable.
type: str type: str
api_url: api_url:
description: description:
- Custom API URL. Overrides the - Custom API URL. Overrides the E(ONEANDONE_API_URL) environment variable.
ONEANDONE_API_URL environment variable.
type: str type: str
datacenter: datacenter:
description: description:
- The datacenter location. - The datacenter location.
type: str type: str
default: US default: US
choices: [ "US", "ES", "DE", "GB" ] choices: ["US", "ES", "DE", "GB"]
hostname: hostname:
description: description:
- The hostname or ID of the server. Only used when state is 'present'. - The hostname or ID of the server. Only used when state is 'present'.
@ -54,35 +51,29 @@ options:
type: str type: str
appliance: appliance:
description: description:
- The operating system name or ID for the server. - The operating system name or ID for the server. It is required only for 'present' state.
It is required only for 'present' state.
type: str type: str
fixed_instance_size: fixed_instance_size:
description: description:
- The instance size name or ID of the server. - The instance size name or ID of the server. It is required only for 'present' state, and it is mutually exclusive with vcore, cores_per_processor,
It is required only for 'present' state, and it is mutually exclusive with ram, and hdds parameters.
vcore, cores_per_processor, ram, and hdds parameters. - 'The available choices are: V(S), V(M), V(L), V(XL), V(XXL), V(3XL), V(4XL), V(5XL).'
- 'The available choices are: V(S), V(M), V(L), V(XL), V(XXL), V(3XL), V(4XL), V(5XL)'
type: str type: str
vcore: vcore:
description: description:
- The total number of processors. - The total number of processors. It must be provided with cores_per_processor, ram, and hdds parameters.
It must be provided with cores_per_processor, ram, and hdds parameters.
type: int type: int
cores_per_processor: cores_per_processor:
description: description:
- The number of cores per processor. - The number of cores per processor. It must be provided with vcore, ram, and hdds parameters.
It must be provided with vcore, ram, and hdds parameters.
type: int type: int
ram: ram:
description: description:
- The amount of RAM memory. - The amount of RAM memory. It must be provided with with vcore, cores_per_processor, and hdds parameters.
It must be provided with with vcore, cores_per_processor, and hdds parameters.
type: float type: float
hdds: hdds:
description: description:
- A list of hard disks with nested "size" and "is_main" properties. - A list of hard disks with nested "size" and "is_main" properties. It must be provided with vcore, cores_per_processor, and ram parameters.
It must be provided with vcore, cores_per_processor, and ram parameters.
type: list type: list
elements: dict elements: dict
private_network: private_network:
@ -119,30 +110,27 @@ options:
- The type of server to be built. - The type of server to be built.
type: str type: str
default: "cloud" default: "cloud"
choices: [ "cloud", "baremetal", "k8s_node" ] choices: ["cloud", "baremetal", "k8s_node"]
wait: wait:
description: description:
- Wait for the server to be in state 'running' before returning. - Wait for the server to be in state 'running' before returning. Also used for delete operation (set to V(false) if you do not want to wait
Also used for delete operation (set to 'false' if you don't want to wait for each individual server to be deleted before moving on with other tasks).
for each individual server to be deleted before moving on with
other tasks.)
type: bool type: bool
default: true default: true
wait_timeout: wait_timeout:
description: description:
- how long before wait gives up, in seconds - How long before wait gives up, in seconds.
type: int type: int
default: 600 default: 600
wait_interval: wait_interval:
description: description:
- Defines the number of seconds to wait when using the wait_for methods - Defines the number of seconds to wait when using the wait_for methods.
type: int type: int
default: 5 default: 5
auto_increment: auto_increment:
description: description:
- When creating multiple servers at once, whether to differentiate - When creating multiple servers at once, whether to differentiate hostnames by appending a count after them or substituting the count where
hostnames by appending a count after them or substituting the count there is a %02d or %03d in the hostname string.
where there is a %02d or %03d in the hostname string.
type: bool type: bool
default: true default: true
@ -152,10 +140,9 @@ requirements:
author: author:
- "Amel Ajdinovic (@aajdinov)" - "Amel Ajdinovic (@aajdinov)"
- "Ethan Devenport (@edevenport)" - "Ethan Devenport (@edevenport)"
"""
''' EXAMPLES = r"""
EXAMPLES = '''
- name: Create three servers and enumerate their names - name: Create three servers and enumerate their names
community.general.oneandone_server: community.general.oneandone_server:
auth_token: oneandone_private_api_key auth_token: oneandone_private_api_key
@ -201,16 +188,16 @@ EXAMPLES = '''
auth_token: oneandone_private_api_key auth_token: oneandone_private_api_key
state: stopped state: stopped
server: 'node01' server: 'node01'
''' """
RETURN = ''' RETURN = r"""
servers: servers:
description: Information about each server that was processed description: Information about each server that was processed.
type: list type: list
sample: sample:
- {"hostname": "my-server", "id": "server-id"} - {"hostname": "my-server", "id": "server-id"}
returned: always returned: always
''' """
import os import os
import time import time

View File

@ -12,15 +12,15 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
module: onepassword_info module: onepassword_info
author: author:
- Ryan Conway (@Rylon) - Ryan Conway (@Rylon)
requirements: requirements:
- C(op) 1Password command line utility. See U(https://support.1password.com/command-line/) - C(op) 1Password command line utility. See U(https://support.1password.com/command-line/)
notes: notes:
- Tested with C(op) version 0.5.5 - Tested with C(op) version 0.5.5.
- "Based on the P(community.general.onepassword#lookup) lookup plugin by Scott Buchanan <sbuchanan@ri.pn>." - Based on the P(community.general.onepassword#lookup) lookup plugin by Scott Buchanan <sbuchanan@ri.pn>.
short_description: Gather items from 1Password short_description: Gather items from 1Password
description: description:
- M(community.general.onepassword_info) wraps the C(op) command line utility to fetch data about one or more 1Password items. - M(community.general.onepassword_info) wraps the C(op) command line utility to fetch data about one or more 1Password items.
@ -46,7 +46,7 @@ options:
field: field:
type: str type: str
description: description:
- The name of the field to search for within this item (optional, defaults to "password" (or "document" if the item has an attachment). - The name of the field to search for within this item (optional, defaults to V(password), or V(document) if the item has an attachment).
section: section:
type: str type: str
description: description:
@ -59,16 +59,16 @@ options:
auto_login: auto_login:
type: dict type: dict
description: description:
- A dictionary containing authentication details. If this is set, M(community.general.onepassword_info) - A dictionary containing authentication details. If this is set, M(community.general.onepassword_info) will attempt to sign in to 1Password
will attempt to sign in to 1Password automatically. automatically.
- Without this option, you must have already logged in via the 1Password CLI before running Ansible. - Without this option, you must have already logged in using the 1Password CLI before running Ansible.
- It is B(highly) recommended to store 1Password credentials in an Ansible Vault. Ensure that the key used to encrypt - It is B(highly) recommended to store 1Password credentials in an Ansible Vault. Ensure that the key used to encrypt the Ansible Vault
the Ansible Vault is equal to or greater in strength than the 1Password master password. is equal to or greater in strength than the 1Password master password.
suboptions: suboptions:
subdomain: subdomain:
type: str type: str
description: description:
- 1Password subdomain name (<subdomain>.1password.com). - 1Password subdomain name (V(subdomain).1password.com).
- If this is not specified, the most recent subdomain will be used. - If this is not specified, the most recent subdomain will be used.
username: username:
type: str type: str
@ -89,12 +89,12 @@ options:
required: false required: false
cli_path: cli_path:
type: path type: path
description: Used to specify the exact path to the C(op) command line interface description: Used to specify the exact path to the C(op) command line interface.
required: false required: false
default: 'op' default: 'op'
''' """
EXAMPLES = ''' EXAMPLES = r"""
# Gather secrets from 1Password, assuming there is a 'password' field: # Gather secrets from 1Password, assuming there is a 'password' field:
- name: Get a password - name: Get a password
community.general.onepassword_info: community.general.onepassword_info:
@ -135,10 +135,9 @@ EXAMPLES = '''
- name: Debug a password (for example) - name: Debug a password (for example)
ansible.builtin.debug: ansible.builtin.debug:
msg: "{{ my_1password_item['onepassword']['My 1Password item'] }}" msg: "{{ my_1password_item['onepassword']['My 1Password item'] }}"
''' """
RETURN = ''' RETURN = r"""
---
# One or more dictionaries for each matching item from 1Password, along with the appropriate fields. # One or more dictionaries for each matching item from 1Password, along with the appropriate fields.
# This shows the response you would expect to receive from the third example documented above. # This shows the response you would expect to receive from the third example documented above.
onepassword: onepassword:
@ -153,7 +152,7 @@ onepassword:
password: the value of this field password: the value of this field
"A 1Password item with document attachment": "A 1Password item with document attachment":
document: the contents of the document attached to this item document: the contents of the document attached to this item
''' """
import errno import errno