[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
__metaclass__ = type
DOCUMENTATION = '''
---
DOCUMENTATION = r"""
module: ocapi_command
version_added: 6.3.0
short_description: Manages Out-Of-Band controllers using Open Composable API (OCAPI)
description:
- Builds OCAPI URIs locally and sends them to remote OOB controllers to
perform an action.
- Builds OCAPI URIs locally and sends them to remote OOB controllers to perform an action.
- Manages OOB controller such as Indicator LED, Reboot, Power Mode, Firmware Update.
extends_documentation_fragment:
- community.general.attributes
@ -41,7 +39,7 @@ options:
- Base URI of OOB controller.
type: str
proxy_slot_number:
description: For proxied inband requests, the slot number of the IOM. Only applies if O(baseuri) is a proxy server.
description: For proxied inband requests, the slot number of the IOM. Only applies if O(baseuri) is a proxy server.
type: int
update_image_path:
required: false
@ -70,104 +68,103 @@ options:
type: int
author: "Mike Moerk (@mikemoerk)"
'''
"""
EXAMPLES = '''
- name: Set the power state to low
community.general.ocapi_command:
category: Chassis
command: PowerModeLow
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
EXAMPLES = r"""
- name: Set the power state to low
community.general.ocapi_command:
category: Chassis
command: PowerModeLow
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
- name: Set the power state to normal
community.general.ocapi_command:
category: Chassis
command: PowerModeNormal
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
- name: Set chassis indicator LED to on
community.general.ocapi_command:
category: Chassis
command: IndicatorLedOn
baseuri: "{{ baseuri }}"
proxy_slot_number: 2
username: "{{ username }}"
password: "{{ password }}"
- name: Set chassis indicator LED to off
community.general.ocapi_command:
category: Chassis
command: IndicatorLedOff
baseuri: "{{ baseuri }}"
proxy_slot_number: 2
username: "{{ username }}"
password: "{{ password }}"
- name: Reset Enclosure
community.general.ocapi_command:
category: Systems
command: PowerGracefulRestart
baseuri: "{{ baseuri }}"
proxy_slot_number: 2
username: "{{ username }}"
password: "{{ password }}"
- name: Firmware Upload
community.general.ocapi_command:
category: Update
command: FWUpload
baseuri: "iom1.wdc.com"
proxy_slot_number: 2
username: "{{ username }}"
password: "{{ password }}"
update_image_path: "/path/to/firmware.tar.gz"
- name: Firmware Update
community.general.ocapi_command:
category: Update
command: FWUpdate
baseuri: "iom1.wdc.com"
proxy_slot_number: 2
username: "{{ username }}"
password: "{{ password }}"
- name: Firmware Activate
community.general.ocapi_command:
category: Update
command: FWActivate
baseuri: "iom1.wdc.com"
proxy_slot_number: 2
username: "{{ username }}"
password: "{{ password }}"
- name: Delete Job
community.general.ocapi_command:
category: Jobs
command: DeleteJob
job_name: FirmwareUpdate
baseuri: "{{ baseuri }}"
proxy_slot_number: 2
username: "{{ username }}"
password: "{{ password }}"
'''
- name: Set the power state to normal
community.general.ocapi_command:
category: Chassis
command: PowerModeNormal
baseuri: "{{ baseuri }}"
username: "{{ username }}"
password: "{{ password }}"
- name: Set chassis indicator LED to on
community.general.ocapi_command:
category: Chassis
command: IndicatorLedOn
baseuri: "{{ baseuri }}"
proxy_slot_number: 2
username: "{{ username }}"
password: "{{ password }}"
- name: Set chassis indicator LED to off
community.general.ocapi_command:
category: Chassis
command: IndicatorLedOff
baseuri: "{{ baseuri }}"
proxy_slot_number: 2
username: "{{ username }}"
password: "{{ password }}"
- name: Reset Enclosure
community.general.ocapi_command:
category: Systems
command: PowerGracefulRestart
baseuri: "{{ baseuri }}"
proxy_slot_number: 2
username: "{{ username }}"
password: "{{ password }}"
- name: Firmware Upload
community.general.ocapi_command:
category: Update
command: FWUpload
baseuri: "iom1.wdc.com"
proxy_slot_number: 2
username: "{{ username }}"
password: "{{ password }}"
update_image_path: "/path/to/firmware.tar.gz"
- name: Firmware Update
community.general.ocapi_command:
category: Update
command: FWUpdate
baseuri: "iom1.wdc.com"
proxy_slot_number: 2
username: "{{ username }}"
password: "{{ password }}"
- name: Firmware Activate
community.general.ocapi_command:
category: Update
command: FWActivate
baseuri: "iom1.wdc.com"
proxy_slot_number: 2
username: "{{ username }}"
password: "{{ password }}"
- name: Delete Job
community.general.ocapi_command:
category: Jobs
command: DeleteJob
job_name: FirmwareUpdate
baseuri: "{{ baseuri }}"
proxy_slot_number: 2
username: "{{ username }}"
password: "{{ password }}"
"""
RETURN = '''
RETURN = r"""
msg:
description: Message with action result or error description.
returned: always
type: str
sample: "Action was successful"
description: Message with action result or error description.
returned: always
type: str
sample: "Action was successful"
jobUri:
description: URI to use to monitor status of the operation. Returned for async commands such as Firmware Update, Firmware Activate.
returned: when supported
type: str
sample: "https://ioma.wdc.com/Storage/Devices/openflex-data24-usalp03020qb0003/Jobs/FirmwareUpdate/"
description: URI to use to monitor status of the operation. Returned for async commands such as Firmware Update, Firmware Activate.
returned: when supported
type: str
sample: "https://ioma.wdc.com/Storage/Devices/openflex-data24-usalp03020qb0003/Jobs/FirmwareUpdate/"
operationStatusId:
description: OCAPI State ID (see OCAPI documentation for possible values).
returned: when supported
type: int
sample: 2
'''
description: OCAPI State ID (see OCAPI documentation for possible values).
returned: when supported
type: int
sample: 2
"""
from ansible.module_utils.basic import AnsibleModule
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
DOCUMENTATION = '''
---
DOCUMENTATION = r"""
module: ocapi_info
version_added: 6.3.0
short_description: Manages Out-Of-Band controllers using Open Composable API (OCAPI)
description:
- Builds OCAPI URIs locally and sends them to remote OOB controllers to
get information back.
- Builds OCAPI URIs locally and sends them to remote OOB controllers to get information back.
extends_documentation_fragment:
- community.general.attributes
- community.general.attributes.info_module
@ -38,7 +36,7 @@ options:
- Base URI of OOB controller.
type: str
proxy_slot_number:
description: For proxied inband requests, the slot number of the IOM. Only applies if O(baseuri) is a proxy server.
description: For proxied inband requests, the slot number of the IOM. Only applies if O(baseuri) is a proxy server.
type: int
username:
required: true
@ -62,63 +60,63 @@ options:
author: "Mike Moerk (@mikemoerk)"
'''
"""
EXAMPLES = '''
- name: Get job status
community.general.ocapi_info:
category: Status
command: JobStatus
baseuri: "http://iom1.wdc.com"
jobName: FirmwareUpdate
username: "{{ username }}"
password: "{{ password }}"
'''
EXAMPLES = r"""
- name: Get job status
community.general.ocapi_info:
category: Status
command: JobStatus
baseuri: "http://iom1.wdc.com"
jobName: FirmwareUpdate
username: "{{ username }}"
password: "{{ password }}"
"""
RETURN = '''
RETURN = r"""
msg:
description: Message with action result or error description.
returned: always
type: str
sample: "Action was successful"
description: Message with action result or error description.
returned: always
type: str
sample: "Action was successful"
percentComplete:
description: Percent complete of the relevant operation. Applies to O(command=JobStatus).
returned: when supported
type: int
sample: 99
description: Percent complete of the relevant operation. Applies to O(command=JobStatus).
returned: when supported
type: int
sample: 99
operationStatus:
description: Status of the relevant operation. Applies to O(command=JobStatus). See OCAPI documentation for details.
returned: when supported
type: str
sample: "Activate needed"
description: Status of the relevant operation. Applies to O(command=JobStatus). See OCAPI documentation for details.
returned: when supported
type: str
sample: "Activate needed"
operationStatusId:
description: Integer value of status (corresponds to operationStatus). Applies to O(command=JobStatus). See OCAPI documentation for details.
returned: when supported
type: int
sample: 65540
description: Integer value of status (corresponds to operationStatus). Applies to O(command=JobStatus). See OCAPI documentation for details.
returned: when supported
type: int
sample: 65540
operationHealth:
description: Health of the operation. Applies to O(command=JobStatus). See OCAPI documentation for details.
returned: when supported
type: str
sample: "OK"
description: Health of the operation. Applies to O(command=JobStatus). See OCAPI documentation for details.
returned: when supported
type: str
sample: "OK"
operationHealthId:
description: >
Integer value for health of the operation (corresponds to RV(operationHealth)). Applies to O(command=JobStatus).
See OCAPI documentation for details.
returned: when supported
type: str
sample: "OK"
description: >-
Integer value for health of the operation (corresponds to RV(operationHealth)). Applies to O(command=JobStatus). See OCAPI documentation for
details.
returned: when supported
type: str
sample: "OK"
details:
description: Details of the relevant operation. Applies to O(command=JobStatus).
returned: when supported
type: list
elements: str
description: Details of the relevant operation. Applies to O(command=JobStatus).
returned: when supported
type: list
elements: str
status:
description: Dictionary containing status information. See OCAPI documentation for details.
@ -139,7 +137,7 @@ status:
"Name": "In service"
}
}
'''
"""
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.community.general.plugins.module_utils.ocapi_utils import OcapiUtils

View File

@ -8,49 +8,46 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
DOCUMENTATION = r"""
module: oci_vcn
short_description: Manage Virtual Cloud Networks(VCN) in OCI
description:
- This module allows the user to create, delete and update virtual cloud networks(VCNs) in OCI.
The complete Oracle Cloud Infrastructure Ansible Modules can be downloaded from
U(https://github.com/oracle/oci-ansible-modules/releases).
- This module allows the user to create, delete and update virtual cloud networks(VCNs) in OCI. The complete Oracle Cloud Infrastructure Ansible
Modules can be downloaded from U(https://github.com/oracle/oci-ansible-modules/releases).
attributes:
check_mode:
support: none
diff_mode:
support: none
check_mode:
support: none
diff_mode:
support: none
options:
cidr_block:
description: The CIDR IP address block of the VCN. Required when creating a VCN with O(state=present).
type: str
required: false
compartment_id:
description: The OCID of the compartment to contain the VCN. Required when creating a VCN with O(state=present).
This option is mutually exclusive with O(vcn_id).
type: str
display_name:
description: A user-friendly name. Does not have to be unique, and it's changeable.
type: str
aliases: [ 'name' ]
dns_label:
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 name (FQDN) for each VNIC within this subnet (for example,
bminstance-1.subnet123.vcn1.oraclevcn.com). Not required to be unique, but it's 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 be changed.
type: str
state:
description: Create or update a VCN with O(state=present). Use O(state=absent) to delete a VCN.
type: str
default: present
choices: ['present', 'absent']
vcn_id:
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 mutually exclusive with O(compartment_id).
type: str
aliases: [ 'id' ]
cidr_block:
description: The CIDR IP address block of the VCN. Required when creating a VCN with O(state=present).
type: str
required: false
compartment_id:
description: The OCID of the compartment to contain the VCN. Required when creating a VCN with O(state=present). This option is mutually exclusive
with O(vcn_id).
type: str
display_name:
description: A user-friendly name. Does not have to be unique, and it's changeable.
type: str
aliases: ['name']
dns_label:
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
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
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
be changed.
type: str
state:
description: Create or update a VCN with O(state=present). Use O(state=absent) to delete a VCN.
type: str
default: present
choices: ['present', 'absent']
vcn_id:
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
mutually exclusive with O(compartment_id).
type: str
aliases: ['id']
author: "Rohit Chaware (@rohitChaware)"
extends_documentation_fragment:
- community.general.oracle
@ -58,10 +55,9 @@ extends_documentation_fragment:
- community.general.oracle_wait_options
- community.general.oracle_tags
- community.general.attributes
"""
'''
EXAMPLES = """
EXAMPLES = r"""
- name: Create a VCN
community.general.oci_vcn:
cidr_block: '10.0.0.0/16'
@ -80,7 +76,7 @@ EXAMPLES = """
state: absent
"""
RETURN = """
RETURN = r"""
vcn:
description: Information about the VCN
returned: On successful create and update operation

View File

@ -8,55 +8,54 @@
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
DOCUMENTATION = r"""
module: odbc
author: "John Westcott IV (@john-westcott-iv)"
version_added: "1.0.0"
short_description: Execute SQL via ODBC
short_description: Execute SQL using ODBC
description:
- Read/Write info via ODBC drivers.
- Read/Write info using ODBC drivers.
extends_documentation_fragment:
- community.general.attributes
- community.general.attributes
attributes:
check_mode:
support: none
diff_mode:
support: none
check_mode:
support: none
diff_mode:
support: none
options:
dsn:
description:
- The connection string passed into ODBC.
required: true
type: str
query:
description:
- The SQL query to perform.
required: true
type: str
params:
description:
- Parameters to pass to the SQL query.
type: list
elements: str
commit:
description:
- Perform a commit after the execution of the SQL query.
- Some databases allow a commit after a select whereas others raise an exception.
- Default is V(true) to support legacy module behavior.
type: bool
default: true
version_added: 1.3.0
dsn:
description:
- The connection string passed into ODBC.
required: true
type: str
query:
description:
- The SQL query to perform.
required: true
type: str
params:
description:
- Parameters to pass to the SQL query.
type: list
elements: str
commit:
description:
- Perform a commit after the execution of the SQL query.
- Some databases allow a commit after a select whereas others raise an exception.
- Default is V(true) to support legacy module behavior.
type: bool
default: true
version_added: 1.3.0
requirements:
- "pyodbc"
notes:
- "Like the command module, this module always returns changed = yes whether or not the query would change the database."
- "To alter this behavior you can use C(changed_when): [yes or no]."
- "For details about return values (description and row_count) see U(https://github.com/mkleehammer/pyodbc/wiki/Cursor)."
'''
- 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): [true or false].'
- 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
community.general.odbc:
dsn: "DRIVER={ODBC Driver 13 for SQL Server};Server=db.ansible.com;Database=my_db;UID=admin;PWD=password;"
@ -65,24 +64,24 @@ EXAMPLES = '''
- "value1"
commit: false
changed_when: false
'''
"""
RETURN = '''
RETURN = r"""
results:
description: List of lists of strings containing selected rows, likely empty for DDL statements.
returned: success
type: list
elements: list
description: List of lists of strings containing selected rows, likely empty for DDL statements.
returned: success
type: list
elements: list
description:
description: "List of dicts about the columns selected from the cursors, likely empty for DDL statements. See notes."
returned: success
type: list
elements: dict
description: "List of dicts about the columns selected from the cursors, likely empty for DDL statements. See notes."
returned: success
type: list
elements: dict
row_count:
description: "The number of rows selected or modified according to the cursor defaults to -1. See notes."
returned: success
type: str
'''
description: "The number of rows selected or modified according to the cursor defaults to V(-1). See notes."
returned: success
type: str
"""
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
from ansible.module_utils.common.text.converters import to_native

View File

@ -8,17 +8,15 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
DOCUMENTATION = r"""
module: office_365_connector_card
short_description: Use webhooks to create Connector Card messages within an Office 365 group
description:
- Creates Connector Card messages through
Office 365 Connectors
U(https://learn.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/cards-reference#connector-card-for-microsoft-365-groups).
- Creates Connector Card messages through 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).
author: "Marc Sensenich (@marc-sensenich)"
notes:
- This module is not idempotent, therefore if the same task is run twice
there will be two Connector Cards created
- This module is not idempotent, therefore if the same task is run twice there will be two Connector Cards created.
extends_documentation_fragment:
- community.general.attributes
attributes:
@ -37,7 +35,7 @@ options:
description:
- A string used for summarizing card content.
- 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:
type: str
description:
@ -51,22 +49,21 @@ options:
description:
- The main text of the card.
- 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:
type: list
elements: dict
description:
- This array of objects will power the action links
- found at the bottom of the card.
- This array of objects will power the action links found at the bottom of the card.
sections:
type: list
elements: dict
description:
- 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).
'''
"""
EXAMPLES = """
EXAMPLES = r"""
- name: Create a simple Connector Card
community.general.office_365_connector_card:
webhook: https://outlook.office.com/webhook/GUID/IncomingWebhook/GUID/GUID
@ -77,71 +74,70 @@ EXAMPLES = """
webhook: https://outlook.office.com/webhook/GUID/IncomingWebhook/GUID/GUID
summary: This is the summary property
title: This is the **card's title** property
text: This is the **card's text** property. Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
text: This is the **card's text** property. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua.
color: E81123
sections:
- title: This is the **section's title** property
activity_image: http://connectorsdemo.azurewebsites.net/images/MSC12_Oscar_002.jpg
activity_title: This is the section's **activityTitle** property
activity_subtitle: This is the section's **activitySubtitle** property
activity_text: This is the section's **activityText** property.
hero_image:
image: http://connectorsdemo.azurewebsites.net/images/WIN12_Scene_01.jpg
title: This is the image's alternate text
text: This is the section's text property. Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
facts:
- name: This is a fact name
value: This is a fact value
- name: This is a fact name
value: This is a fact value
- name: This is a fact name
value: This is a fact value
images:
- image: http://connectorsdemo.azurewebsites.net/images/MicrosoftSurface_024_Cafe_OH-06315_VS_R1c.jpg
title: This is the image's alternate text
- image: http://connectorsdemo.azurewebsites.net/images/WIN12_Scene_01.jpg
title: This is the image's alternate text
- image: http://connectorsdemo.azurewebsites.net/images/WIN12_Anthony_02.jpg
title: This is the image's alternate text
actions:
- "@type": ActionCard
name: Comment
inputs:
- "@type": TextInput
id: comment
is_multiline: true
title: Input's title property
- title: This is the **section's title** property
activity_image: http://connectorsdemo.azurewebsites.net/images/MSC12_Oscar_002.jpg
activity_title: This is the section's **activityTitle** property
activity_subtitle: This is the section's **activitySubtitle** property
activity_text: This is the section's **activityText** property.
hero_image:
image: http://connectorsdemo.azurewebsites.net/images/WIN12_Scene_01.jpg
title: This is the image's alternate text
text: This is the section's text property. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
ut labore et dolore magna aliqua.
facts:
- name: This is a fact name
value: This is a fact value
- name: This is a fact name
value: This is a fact value
- name: This is a fact name
value: This is a fact value
images:
- image: http://connectorsdemo.azurewebsites.net/images/MicrosoftSurface_024_Cafe_OH-06315_VS_R1c.jpg
title: This is the image's alternate text
- image: http://connectorsdemo.azurewebsites.net/images/WIN12_Scene_01.jpg
title: This is the image's alternate text
- image: http://connectorsdemo.azurewebsites.net/images/WIN12_Anthony_02.jpg
title: This is the image's alternate text
actions:
- "@type": HttpPOST
name: Save
target: http://...
- "@type": ActionCard
name: Due Date
inputs:
- "@type": DateInput
id: dueDate
title: Input's title property
actions:
- "@type": HttpPOST
name: Save
target: http://...
- "@type": HttpPOST
name: Action's name prop.
target: http://...
- "@type": OpenUri
name: Action's name prop
targets:
- os: default
uri: http://...
- start_group: true
title: This is the title of a **second section**
text: This second section is visually separated from the first one by setting its
**startGroup** property to true.
- "@type": ActionCard
name: Comment
inputs:
- "@type": TextInput
id: comment
is_multiline: true
title: Input's title property
actions:
- "@type": HttpPOST
name: Save
target: http://...
- "@type": ActionCard
name: Due Date
inputs:
- "@type": DateInput
id: dueDate
title: Input's title property
actions:
- "@type": HttpPOST
name: Save
target: http://...
- "@type": HttpPOST
name: Action's name prop.
target: http://...
- "@type": OpenUri
name: Action's name prop
targets:
- os: default
uri: http://...
- start_group: true
title: This is the title of a **second section**
text: This second section is visually separated from the first one by setting its **startGroup** property to true.
"""
RETURN = """
RETURN = r"""
"""
# import module snippets

View File

@ -9,15 +9,12 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
DOCUMENTATION = r"""
module: ohai
short_description: Returns inventory data from I(Ohai)
description:
- 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 host and
returns JSON inventory data.
I(Ohai) data is a bit more verbose and nested than I(facter).
- 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
host and returns JSON inventory data. I(Ohai) data is a bit more verbose and nested than I(facter).
extends_documentation_fragment:
- community.general.attributes
attributes:
@ -27,16 +24,16 @@ attributes:
support: none
options: {}
notes: []
requirements: [ "ohai" ]
requirements: ["ohai"]
author:
- "Ansible Core Team"
- "Michael DeHaan (@mpdehaan)"
'''
"""
EXAMPLES = '''
# Retrieve (ohai) data from all Web servers and store in one-file per host
EXAMPLES = r"""
ansible webservers -m ohai --tree=/tmp/ohaidata
'''
...
"""
import json
from ansible.module_utils.basic import AnsibleModule

View File

@ -10,11 +10,10 @@
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = r'''
---
DOCUMENTATION = r"""
module: omapi_host
short_description: Setup OMAPI hosts
description: Manage OMAPI hosts into compatible DHCPd servers
description: Manage OMAPI hosts into compatible DHCPd servers.
requirements:
- pypureomapi
author:
@ -22,65 +21,64 @@ author:
extends_documentation_fragment:
- community.general.attributes
attributes:
check_mode:
support: none
diff_mode:
support: none
check_mode:
support: none
diff_mode:
support: none
options:
state:
description:
- Create or remove OMAPI host.
type: str
required: true
choices: [ absent, present ]
hostname:
description:
- Sets the host lease hostname (mandatory if state=present).
type: str
aliases: [ name ]
host:
description:
- Sets OMAPI server host to interact with.
type: str
default: localhost
port:
description:
- Sets the OMAPI server port to interact with.
type: int
default: 7911
key_name:
description:
- Sets the TSIG key name for authenticating against OMAPI server.
type: str
required: true
key:
description:
- Sets the TSIG key content for authenticating against OMAPI server.
type: str
required: true
macaddr:
description:
- Sets the lease host MAC address.
type: str
required: true
ip:
description:
- Sets the lease host IP address.
type: str
statements:
description:
- Attach a list of OMAPI DHCP statements with host lease (without ending semicolon).
type: list
elements: str
default: []
ddns:
description:
- Enable dynamic DNS updates for this host.
type: bool
default: false
'''
EXAMPLES = r'''
state:
description:
- Create or remove OMAPI host.
type: str
required: true
choices: [absent, present]
hostname:
description:
- Sets the host lease hostname (mandatory if O(state=present)).
type: str
aliases: [name]
host:
description:
- Sets OMAPI server host to interact with.
type: str
default: localhost
port:
description:
- Sets the OMAPI server port to interact with.
type: int
default: 7911
key_name:
description:
- Sets the TSIG key name for authenticating against OMAPI server.
type: str
required: true
key:
description:
- Sets the TSIG key content for authenticating against OMAPI server.
type: str
required: true
macaddr:
description:
- Sets the lease host MAC address.
type: str
required: true
ip:
description:
- Sets the lease host IP address.
type: str
statements:
description:
- Attach a list of OMAPI DHCP statements with host lease (without ending semicolon).
type: list
elements: str
default: []
ddns:
description:
- Enable dynamic DNS updates for this host.
type: bool
default: false
"""
EXAMPLES = r"""
- name: Add a host using OMAPI
community.general.omapi_host:
key_name: defomapi
@ -91,8 +89,8 @@ EXAMPLES = r'''
ip: 192.168.88.99
ddns: true
statements:
- filename "pxelinux.0"
- next-server 1.1.1.1
- filename "pxelinux.0"
- next-server 1.1.1.1
state: present
- name: Remove a host using OMAPI
@ -102,35 +100,35 @@ EXAMPLES = r'''
host: 10.1.1.1
macaddr: 00:66:ab:dd:11:44
state: absent
'''
"""
RETURN = r'''
RETURN = r"""
lease:
description: dictionary containing host information
returned: success
type: complex
contains:
ip-address:
description: IP address, if there is.
returned: success
type: str
sample: '192.168.1.5'
hardware-address:
description: MAC address
returned: success
type: str
sample: '00:11:22:33:44:55'
hardware-type:
description: hardware type, generally '1'
returned: success
type: int
sample: 1
name:
description: hostname
returned: success
type: str
sample: 'mydesktop'
'''
description: Dictionary containing host information.
returned: success
type: complex
contains:
ip-address:
description: IP address, if there is.
returned: success
type: str
sample: '192.168.1.5'
hardware-address:
description: MAC address.
returned: success
type: str
sample: '00:11:22:33:44:55'
hardware-type:
description: Hardware type, generally V(1).
returned: success
type: int
sample: 1
name:
description: Hostname.
returned: success
type: str
sample: 'mydesktop'
"""
import binascii
import socket

View File

@ -10,87 +10,85 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
---
DOCUMENTATION = r"""
module: one_host
short_description: Manages OpenNebula Hosts
requirements:
- pyone
- pyone
description:
- "Manages OpenNebula Hosts"
- Manages OpenNebula Hosts.
attributes:
check_mode:
support: none
diff_mode:
support: none
check_mode:
support: none
diff_mode:
support: none
options:
name:
description:
- Hostname of the machine to manage.
required: true
type: str
state:
description:
- Takes the host to the desired lifecycle state.
- 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(enabled) the host is fully operational.
- V(disabled), e.g. to perform maintenance operations.
- V(offline), host is totally offline.
choices:
- absent
- present
- enabled
- disabled
- offline
default: present
type: str
im_mad_name:
description:
- The name of the information manager, this values are taken from the oned.conf with the tag name IM_MAD (name)
default: kvm
type: str
vmm_mad_name:
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)
default: kvm
type: str
cluster_id:
description:
- The cluster ID.
default: 0
type: int
cluster_name:
description:
- The cluster specified by name.
type: str
labels:
description:
- The labels for this host.
type: list
elements: str
template:
description:
- The template or attribute changes to merge into the host template.
aliases:
- attributes
type: dict
name:
description:
- Hostname of the machine to manage.
required: true
type: str
state:
description:
- Takes the host to the desired lifecycle state.
- 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(enabled) the host is fully operational.
- V(disabled), for example to perform maintenance operations.
- V(offline), host is totally offline.
choices:
- absent
- present
- enabled
- disabled
- offline
default: present
type: str
im_mad_name:
description:
- The name of the information manager, this values are taken from the oned.conf with the tag name IM_MAD (name).
default: kvm
type: str
vmm_mad_name:
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).
default: kvm
type: str
cluster_id:
description:
- The cluster ID.
default: 0
type: int
cluster_name:
description:
- The cluster specified by name.
type: str
labels:
description:
- The labels for this host.
type: list
elements: str
template:
description:
- The template or attribute changes to merge into the host template.
aliases:
- attributes
type: dict
extends_documentation_fragment:
- community.general.opennebula
- community.general.attributes
- community.general.opennebula
- community.general.attributes
author:
- Rafael del Valle (@rvalle)
'''
- Rafael del Valle (@rvalle)
"""
EXAMPLES = '''
EXAMPLES = r"""
- name: Create a new host in OpenNebula
community.general.one_host:
name: host1
@ -102,15 +100,15 @@ EXAMPLES = '''
name: host2
cluster_name: default
template:
LABELS:
- gold
- ssd
RESERVED_CPU: -100
'''
LABELS:
- gold
- ssd
RESERVED_CPU: -100
"""
# 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: To be coherent with CLI this module should also provide "flush" functionality

View File

@ -8,82 +8,81 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
---
DOCUMENTATION = r"""
module: one_image
short_description: Manages OpenNebula images
description:
- Manages OpenNebula images
- Manages OpenNebula images.
requirements:
- pyone
extends_documentation_fragment:
- community.general.opennebula
- community.general.attributes
attributes:
check_mode:
support: full
diff_mode:
support: none
check_mode:
support: full
diff_mode:
support: none
options:
id:
description:
- A O(id) of the image you would like to manage.
type: int
name:
description:
- A O(name) of the image you would like to manage.
- Required if O(create=true).
type: str
state:
description:
- V(present) - state that is used to manage the image.
- V(absent) - delete the image.
- V(cloned) - clone the image.
- V(renamed) - rename the image to the O(new_name).
choices: ["present", "absent", "cloned", "renamed"]
default: present
type: str
enabled:
description:
- Whether the image should be enabled or disabled.
type: bool
new_name:
description:
- A name that will be assigned to the existing or new image.
- In the case of cloning, by default O(new_name) will take the name of the origin image with the prefix 'Copy of'.
type: str
persistent:
description:
- Whether the image should be persistent or non-persistent.
type: bool
version_added: 9.5.0
create:
description:
- Whether the image should be created if not present.
- This is ignored if O(state=absent).
type: bool
version_added: 10.0.0
template:
description:
- Use with O(create=true) to specify image template.
type: str
version_added: 10.0.0
datastore_id:
description:
- Use with O(create=true) to specify datastore for image.
type: int
version_added: 10.0.0
wait_timeout:
description:
- Seconds to wait until image is ready, deleted or cloned.
type: int
default: 60
version_added: 10.0.0
id:
description:
- A O(id) of the image you would like to manage.
type: int
name:
description:
- A O(name) of the image you would like to manage.
- Required if O(create=true).
type: str
state:
description:
- V(present) - state that is used to manage the image.
- V(absent) - delete the image.
- V(cloned) - clone the image.
- V(renamed) - rename the image to the O(new_name).
choices: ["present", "absent", "cloned", "renamed"]
default: present
type: str
enabled:
description:
- Whether the image should be enabled or disabled.
type: bool
new_name:
description:
- A name that will be assigned to the existing or new image.
- In the case of cloning, by default O(new_name) will take the name of the origin image with the prefix 'Copy of'.
type: str
persistent:
description:
- Whether the image should be persistent or non-persistent.
type: bool
version_added: 9.5.0
create:
description:
- Whether the image should be created if not present.
- This is ignored if O(state=absent).
type: bool
version_added: 10.0.0
template:
description:
- Use with O(create=true) to specify image template.
type: str
version_added: 10.0.0
datastore_id:
description:
- Use with O(create=true) to specify datastore for image.
type: int
version_added: 10.0.0
wait_timeout:
description:
- Seconds to wait until image is ready, deleted or cloned.
type: int
default: 60
version_added: 10.0.0
author:
- "Milan Ilic (@ilicmilan)"
'''
- "Milan Ilic (@ilicmilan)"
"""
EXAMPLES = '''
EXAMPLES = r"""
- name: Fetch the IMAGE by id
community.general.one_image:
id: 45
@ -147,228 +146,228 @@ EXAMPLES = '''
create: true
datastore_id: 100
wait_timeout: 900
template: |
template: |-
PATH = "https://192.0.2.200/repo/tipa_image.raw"
TYPE = "OS"
SIZE = 82048
FORMAT = "raw"
PERSISTENT = "Yes"
DEV_PREFIX = "vd"
'''
"""
RETURN = '''
RETURN = r"""
id:
description: image id
type: int
returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample: 153
description: Image id.
type: int
returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample: 153
name:
description: image name
type: str
returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample: app1
description: Image name.
type: str
returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample: app1
group_id:
description: image's group id
type: int
returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample: 1
description: Image's group id.
type: int
returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample: 1
group_name:
description: image's group name
type: str
returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample: one-users
description: Image's group name.
type: str
returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample: one-users
owner_id:
description: image's owner id
type: int
returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample: 143
description: Image's owner id.
type: int
returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample: 143
owner_name:
description: image's owner name
type: str
returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample: ansible-test
description: Image's owner name.
type: str
returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample: ansible-test
state:
description: state of image instance
type: str
returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample: READY
description: State of image instance.
type: str
returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample: READY
used:
description: is image in use
type: bool
returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample: true
description: Is image in use.
type: bool
returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample: true
running_vms:
description: count of running vms that use this image
type: int
returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample: 7
description: Count of running vms that use this image.
type: int
returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample: 7
permissions:
description: The image's permissions.
type: dict
returned: when O(state=present), O(state=cloned), or O(state=renamed)
version_added: 9.5.0
contains:
owner_u:
description: The image's owner USAGE permissions.
type: str
sample: 1
owner_m:
description: The image's owner MANAGE permissions.
type: str
sample: 0
owner_a:
description: The image's owner ADMIN permissions.
type: str
sample: 0
group_u:
description: The image's group USAGE permissions.
type: str
sample: 0
group_m:
description: The image's group MANAGE permissions.
type: str
sample: 0
group_a:
description: The image's group ADMIN permissions.
type: str
sample: 0
other_u:
description: The image's other users USAGE permissions.
type: str
sample: 0
other_m:
description: The image's other users MANAGE permissions.
type: str
sample: 0
other_a:
description: The image's other users ADMIN permissions
type: str
sample: 0
sample:
owner_u: 1
owner_m: 0
owner_a: 0
group_u: 0
group_m: 0
group_a: 0
other_u: 0
other_m: 0
other_a: 0
description: The image's permissions.
type: dict
returned: when O(state=present), O(state=cloned), or O(state=renamed)
version_added: 9.5.0
contains:
owner_u:
description: The image's owner USAGE permissions.
type: str
sample: 1
owner_m:
description: The image's owner MANAGE permissions.
type: str
sample: 0
owner_a:
description: The image's owner ADMIN permissions.
type: str
sample: 0
group_u:
description: The image's group USAGE permissions.
type: str
sample: 0
group_m:
description: The image's group MANAGE permissions.
type: str
sample: 0
group_a:
description: The image's group ADMIN permissions.
type: str
sample: 0
other_u:
description: The image's other users USAGE permissions.
type: str
sample: 0
other_m:
description: The image's other users MANAGE permissions.
type: str
sample: 0
other_a:
description: The image's other users ADMIN permissions.
type: str
sample: 0
sample:
owner_u: 1
owner_m: 0
owner_a: 0
group_u: 0
group_m: 0
group_a: 0
other_u: 0
other_m: 0
other_a: 0
type:
description: The image's type.
type: str
sample: 0
returned: when O(state=present), O(state=cloned), or O(state=renamed)
version_added: 9.5.0
description: The image's type.
type: str
sample: 0
returned: when O(state=present), O(state=cloned), or O(state=renamed)
version_added: 9.5.0
disk_type:
description: The image's format type.
type: str
sample: 0
returned: when O(state=present), O(state=cloned), or O(state=renamed)
version_added: 9.5.0
description: The image's format type.
type: str
sample: 0
returned: when O(state=present), O(state=cloned), or O(state=renamed)
version_added: 9.5.0
persistent:
description: The image's persistence status (1 means true, 0 means false).
type: int
sample: 1
returned: when O(state=present), O(state=cloned), or O(state=renamed)
version_added: 9.5.0
description: The image's persistence status (1 means true, 0 means false).
type: int
sample: 1
returned: when O(state=present), O(state=cloned), or O(state=renamed)
version_added: 9.5.0
source:
description: The image's source.
type: str
sample: /var/lib/one//datastores/100/somerandomstringxd
returned: when O(state=present), O(state=cloned), or O(state=renamed)
description: The image's source.
type: str
sample: /var/lib/one//datastores/100/somerandomstringxd
returned: when O(state=present), O(state=cloned), or O(state=renamed)
path:
description: The image's filesystem path.
type: str
sample: /var/tmp/hello.qcow2
returned: when O(state=present), O(state=cloned), or O(state=renamed)
version_added: 9.5.0
description: The image's filesystem path.
type: str
sample: /var/tmp/hello.qcow2
returned: when O(state=present), O(state=cloned), or O(state=renamed)
version_added: 9.5.0
fstype:
description: The image's filesystem type.
type: str
sample: ext4
returned: when O(state=present), O(state=cloned), or O(state=renamed)
version_added: 9.5.0
description: The image's filesystem type.
type: str
sample: ext4
returned: when O(state=present), O(state=cloned), or O(state=renamed)
version_added: 9.5.0
size:
description: The image's size in MegaBytes.
type: int
sample: 10000
returned: when O(state=present), O(state=cloned), or O(state=renamed)
version_added: 9.5.0
description: The image's size in MegaBytes.
type: int
sample: 10000
returned: when O(state=present), O(state=cloned), or O(state=renamed)
version_added: 9.5.0
cloning_ops:
description: The image's cloning operations per second.
type: int
sample: 0
returned: when O(state=present), O(state=cloned), or O(state=renamed)
version_added: 9.5.0
description: The image's cloning operations per second.
type: int
sample: 0
returned: when O(state=present), O(state=cloned), or O(state=renamed)
version_added: 9.5.0
cloning_id:
description: The image's cloning ID.
type: int
sample: -1
returned: when O(state=present), O(state=cloned), or O(state=renamed)
version_added: 9.5.0
description: The image's cloning ID.
type: int
sample: -1
returned: when O(state=present), O(state=cloned), or O(state=renamed)
version_added: 9.5.0
target_snapshot:
description: The image's target snapshot.
type: int
sample: 1
returned: when O(state=present), O(state=cloned), or O(state=renamed)
version_added: 9.5.0
description: The image's target snapshot.
type: int
sample: 1
returned: when O(state=present), O(state=cloned), or O(state=renamed)
version_added: 9.5.0
datastore_id:
description: The image's datastore ID.
type: int
sample: 100
returned: when O(state=present), O(state=cloned), or O(state=renamed)
version_added: 9.5.0
description: The image's datastore ID.
type: int
sample: 100
returned: when O(state=present), O(state=cloned), or O(state=renamed)
version_added: 9.5.0
datastore:
description: The image's datastore name.
type: int
sample: image_datastore
returned: when O(state=present), O(state=cloned), or O(state=renamed)
version_added: 9.5.0
description: The image's datastore name.
type: int
sample: image_datastore
returned: when O(state=present), O(state=cloned), or O(state=renamed)
version_added: 9.5.0
vms:
description: The image's list of vm ID's.
type: list
elements: int
returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample:
- 1
- 2
- 3
version_added: 9.5.0
description: The image's list of vm ID's.
type: list
elements: int
returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample:
- 1
- 2
- 3
version_added: 9.5.0
clones:
description: The image's list of clones ID's.
type: list
elements: int
returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample:
- 1
- 2
- 3
version_added: 9.5.0
description: The image's list of clones ID's.
type: list
elements: int
returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample:
- 1
- 2
- 3
version_added: 9.5.0
app_clones:
description: The image's list of app_clones ID's.
type: list
elements: int
returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample:
- 1
- 2
- 3
version_added: 9.5.0
description: The image's list of app_clones ID's.
type: list
elements: int
returned: when O(state=present), O(state=cloned), or O(state=renamed)
sample:
- 1
- 2
- 3
version_added: 9.5.0
snapshots:
description: The image's list of snapshots.
type: list
returned: when O(state=present), O(state=cloned), or O(state=renamed)
version_added: 9.5.0
sample:
- date: 123123
parent: 1
size: 10228
allow_orphans: 1
children: 0
active: 1
name: SampleName
'''
description: The image's list of snapshots.
type: list
returned: when O(state=present), O(state=cloned), or O(state=renamed)
version_added: 9.5.0
sample:
- date: 123123
parent: 1
size: 10228
allow_orphans: 1
children: 0
active: 1
name: SampleName
"""
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)
__metaclass__ = type
DOCUMENTATION = '''
---
DOCUMENTATION = r"""
module: one_image_info
short_description: Gather information on OpenNebula images
description:
@ -31,17 +30,17 @@ options:
name:
description:
- 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
- which restricts the list of images (whose facts will be returned) whose names match specified regex.
- 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.
- Also, if the O(name) begins with V(~*) case-insensitive matching will be performed.
- See examples for more details.
type: str
author:
- "Milan Ilic (@ilicmilan)"
- "Jan Meerkamp (@meerkampdvv)"
'''
- "Milan Ilic (@ilicmilan)"
- "Jan Meerkamp (@meerkampdvv)"
"""
EXAMPLES = '''
EXAMPLES = r"""
- name: Gather facts about all images
community.general.one_image_info:
register: result
@ -76,201 +75,201 @@ EXAMPLES = '''
community.general.one_image_info:
name: '~*foo-image-.*'
register: foo_images
'''
"""
RETURN = '''
RETURN = r"""
images:
description: A list of images info
type: complex
returned: success
contains:
id:
description: The image's id.
type: int
sample: 153
name:
description: The image's name.
type: str
sample: app1
group_id:
description: The image's group id
type: int
sample: 1
group_name:
description: The image's group name.
type: str
sample: one-users
owner_id:
description: The image's owner id.
type: int
sample: 143
owner_name:
description: The image's owner name.
type: str
sample: ansible-test
state:
description: The image's state.
type: str
sample: READY
used:
description: The image's usage status.
type: bool
sample: true
running_vms:
description: The image's count of running vms that use this image.
type: int
sample: 7
permissions:
description: The image's permissions.
type: dict
version_added: 9.5.0
contains:
owner_u:
description: The image's owner USAGE permissions.
type: str
sample: 1
owner_m:
description: The image's owner MANAGE permissions.
type: str
sample: 0
owner_a:
description: The image's owner ADMIN permissions.
type: str
sample: 0
group_u:
description: The image's group USAGE permissions.
type: str
sample: 0
group_m:
description: The image's group MANAGE permissions.
type: str
sample: 0
group_a:
description: The image's group ADMIN permissions.
type: str
sample: 0
other_u:
description: The image's other users USAGE permissions.
type: str
sample: 0
other_m:
description: The image's other users MANAGE permissions.
type: str
sample: 0
other_a:
description: The image's other users ADMIN permissions
type: str
sample: 0
sample:
owner_u: 1
owner_m: 0
owner_a: 0
group_u: 0
group_m: 0
group_a: 0
other_u: 0
other_m: 0
other_a: 0
type:
description: The image's type.
type: int
sample: 0
version_added: 9.5.0
disk_type:
description: The image's format type.
type: int
sample: 0
version_added: 9.5.0
persistent:
description: The image's persistence status (1 means true, 0 means false).
type: int
sample: 1
version_added: 9.5.0
source:
description: The image's source.
type: str
sample: /var/lib/one//datastores/100/somerandomstringxd
version_added: 9.5.0
path:
description: The image's filesystem path.
type: str
sample: /var/tmp/hello.qcow2
version_added: 9.5.0
fstype:
description: The image's filesystem type.
type: str
sample: ext4
version_added: 9.5.0
size:
description: The image's size in MegaBytes.
type: int
sample: 10000
version_added: 9.5.0
cloning_ops:
description: The image's cloning operations per second.
type: int
sample: 0
version_added: 9.5.0
cloning_id:
description: The image's cloning ID.
type: int
sample: -1
version_added: 9.5.0
target_snapshot:
description: The image's target snapshot.
type: int
sample: 1
version_added: 9.5.0
datastore_id:
description: The image's datastore ID.
type: int
sample: 100
version_added: 9.5.0
datastore:
description: The image's datastore name.
type: int
sample: image_datastore
version_added: 9.5.0
vms:
description: The image's list of vm ID's.
type: list
elements: int
version_added: 9.5.0
sample:
- 1
- 2
- 3
clones:
description: The image's list of clones ID's.
type: list
elements: int
version_added: 9.5.0
sample:
- 1
- 2
- 3
app_clones:
description: The image's list of app_clones ID's.
type: list
elements: int
version_added: 9.5.0
sample:
- 1
- 2
- 3
snapshots:
description: The image's list of snapshots.
type: list
version_added: 9.5.0
sample:
- date: 123123
parent: 1
size: 10228
allow_orphans: 1
children: 0
active: 1
name: SampleName
'''
description: A list of images info.
type: complex
returned: success
contains:
id:
description: The image's id.
type: int
sample: 153
name:
description: The image's name.
type: str
sample: app1
group_id:
description: The image's group id.
type: int
sample: 1
group_name:
description: The image's group name.
type: str
sample: one-users
owner_id:
description: The image's owner id.
type: int
sample: 143
owner_name:
description: The image's owner name.
type: str
sample: ansible-test
state:
description: The image's state.
type: str
sample: READY
used:
description: The image's usage status.
type: bool
sample: true
running_vms:
description: The image's count of running vms that use this image.
type: int
sample: 7
permissions:
description: The image's permissions.
type: dict
version_added: 9.5.0
contains:
owner_u:
description: The image's owner USAGE permissions.
type: str
sample: 1
owner_m:
description: The image's owner MANAGE permissions.
type: str
sample: 0
owner_a:
description: The image's owner ADMIN permissions.
type: str
sample: 0
group_u:
description: The image's group USAGE permissions.
type: str
sample: 0
group_m:
description: The image's group MANAGE permissions.
type: str
sample: 0
group_a:
description: The image's group ADMIN permissions.
type: str
sample: 0
other_u:
description: The image's other users USAGE permissions.
type: str
sample: 0
other_m:
description: The image's other users MANAGE permissions.
type: str
sample: 0
other_a:
description: The image's other users ADMIN permissions.
type: str
sample: 0
sample:
owner_u: 1
owner_m: 0
owner_a: 0
group_u: 0
group_m: 0
group_a: 0
other_u: 0
other_m: 0
other_a: 0
type:
description: The image's type.
type: int
sample: 0
version_added: 9.5.0
disk_type:
description: The image's format type.
type: int
sample: 0
version_added: 9.5.0
persistent:
description: The image's persistence status (1 means true, 0 means false).
type: int
sample: 1
version_added: 9.5.0
source:
description: The image's source.
type: str
sample: /var/lib/one//datastores/100/somerandomstringxd
version_added: 9.5.0
path:
description: The image's filesystem path.
type: str
sample: /var/tmp/hello.qcow2
version_added: 9.5.0
fstype:
description: The image's filesystem type.
type: str
sample: ext4
version_added: 9.5.0
size:
description: The image's size in MegaBytes.
type: int
sample: 10000
version_added: 9.5.0
cloning_ops:
description: The image's cloning operations per second.
type: int
sample: 0
version_added: 9.5.0
cloning_id:
description: The image's cloning ID.
type: int
sample: -1
version_added: 9.5.0
target_snapshot:
description: The image's target snapshot.
type: int
sample: 1
version_added: 9.5.0
datastore_id:
description: The image's datastore ID.
type: int
sample: 100
version_added: 9.5.0
datastore:
description: The image's datastore name.
type: int
sample: image_datastore
version_added: 9.5.0
vms:
description: The image's list of vm ID's.
type: list
elements: int
version_added: 9.5.0
sample:
- 1
- 2
- 3
clones:
description: The image's list of clones ID's.
type: list
elements: int
version_added: 9.5.0
sample:
- 1
- 2
- 3
app_clones:
description: The image's list of app_clones ID's.
type: list
elements: int
version_added: 9.5.0
sample:
- 1
- 2
- 3
snapshots:
description: The image's list of snapshots.
type: list
version_added: 9.5.0
sample:
- date: 123123
parent: 1
size: 10228
allow_orphans: 1
children: 0
active: 1
name: SampleName
"""
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)
__metaclass__ = type
DOCUMENTATION = '''
---
DOCUMENTATION = r"""
module: one_service
short_description: Deploy and manage OpenNebula services
description:
- Manage OpenNebula services
- Manage OpenNebula services.
extends_documentation_fragment:
- community.general.attributes
attributes:
@ -30,11 +29,13 @@ options:
type: str
api_username:
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
api_password:
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
template_name:
description:
@ -54,8 +55,8 @@ options:
type: str
unique:
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
instantiating a service from a template specified with O(template_id) or O(template_name). Check examples below.
- 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
a service from a template specified with O(template_id) or O(template_name). Check examples below.
type: bool
default: false
state:
@ -67,7 +68,8 @@ options:
type: str
mode:
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
owner_id:
description:
@ -106,10 +108,10 @@ options:
type: bool
default: false
author:
- "Milan Ilic (@ilicmilan)"
'''
- "Milan Ilic (@ilicmilan)"
"""
EXAMPLES = '''
EXAMPLES = r"""
- name: Instantiate a new service
community.general.one_service:
template_id: 90
@ -178,57 +180,57 @@ EXAMPLES = '''
role: foo
cardinality: 7
wait: true
'''
"""
RETURN = '''
RETURN = r"""
service_id:
description: service id
type: int
returned: success
sample: 153
description: Service id.
type: int
returned: success
sample: 153
service_name:
description: service name
type: str
returned: success
sample: app1
description: Service name.
type: str
returned: success
sample: app1
group_id:
description: service's group id
type: int
returned: success
sample: 1
description: Service's group id.
type: int
returned: success
sample: 1
group_name:
description: service's group name
type: str
returned: success
sample: one-users
description: Service's group name.
type: str
returned: success
sample: one-users
owner_id:
description: service's owner id
type: int
returned: success
sample: 143
description: Service's owner id.
type: int
returned: success
sample: 143
owner_name:
description: service's owner name
type: str
returned: success
sample: ansible-test
description: Service's owner name.
type: str
returned: success
sample: ansible-test
state:
description: state of service instance
type: str
returned: success
sample: RUNNING
description: State of service instance.
type: str
returned: success
sample: RUNNING
mode:
description: service's mode
type: int
returned: success
sample: 660
description: Service's mode.
type: int
returned: success
sample: 660
roles:
description: list of dictionaries of roles, each role is described by name, cardinality, state and nodes ids
type: list
returned: success
sample:
- {"cardinality": 1,"name": "foo","state": "RUNNING", "ids": [ 123, 456 ]}
- {"cardinality": 2,"name": "bar","state": "RUNNING", "ids": [ 452, 567, 746 ]}
'''
description: List of dictionaries of roles, each role is described by name, cardinality, state and nodes ids.
type: list
returned: success
sample:
- {"cardinality": 1, "name": "foo", "state": "RUNNING", "ids": [123, 456]}
- {"cardinality": 2, "name": "bar", "state": "RUNNING", "ids": [452, 567, 746]}
"""
import os
from ansible.module_utils.basic import AnsibleModule

View File

@ -9,8 +9,7 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
---
DOCUMENTATION = r"""
module: one_template
short_description: Manages OpenNebula templates
@ -21,8 +20,7 @@ requirements:
- pyone
description:
- "Manages OpenNebula templates."
- Manages OpenNebula templates.
attributes:
check_mode:
support: partial
@ -34,14 +32,12 @@ attributes:
options:
id:
description:
- 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).
- 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).
type: int
name:
description:
- A O(name) of the template you would like to manage. If a template with
- the given name does not exist it will be created, otherwise it will be
- managed by this module.
- A O(name) of the template you would like to manage.
If a template with the given name does not exist it will be created, otherwise it will be managed by this module.
type: str
template:
description:
@ -61,9 +57,9 @@ extends_documentation_fragment:
author:
- "Jyrki Gadinger (@nilsding)"
'''
"""
EXAMPLES = '''
EXAMPLES = r"""
- name: Fetch the TEMPLATE by id
community.general.one_template:
id: 6459
@ -110,44 +106,44 @@ EXAMPLES = '''
community.general.one_template:
id: 6459
state: absent
'''
"""
RETURN = '''
RETURN = r"""
id:
description: template id
type: int
returned: when O(state=present)
sample: 153
description: Template id.
type: int
returned: when O(state=present)
sample: 153
name:
description: template name
type: str
returned: when O(state=present)
sample: app1
description: Template name.
type: str
returned: when O(state=present)
sample: app1
template:
description: the parsed template
type: dict
returned: when O(state=present)
description: The parsed template.
type: dict
returned: when O(state=present)
group_id:
description: template's group id
type: int
returned: when O(state=present)
sample: 1
description: Template's group id.
type: int
returned: when O(state=present)
sample: 1
group_name:
description: template's group name
type: str
returned: when O(state=present)
sample: one-users
description: Template's group name.
type: str
returned: when O(state=present)
sample: one-users
owner_id:
description: template's owner id
type: int
returned: when O(state=present)
sample: 143
description: Template's owner id.
type: int
returned: when O(state=present)
sample: 143
owner_name:
description: template's owner name
type: str
returned: when O(state=present)
sample: ansible-test
'''
description: Template's owner name.
type: str
returned: when O(state=present)
sample: ansible-test
"""
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)
__metaclass__ = type
DOCUMENTATION = '''
---
DOCUMENTATION = r"""
module: one_vm
short_description: Creates or terminates OpenNebula instances
description:
- Manages OpenNebula instances
- Manages OpenNebula instances.
requirements:
- pyone
extends_documentation_fragment:
@ -28,34 +27,30 @@ options:
api_url:
description:
- URL of the OpenNebula RPC server.
- It is recommended to use HTTPS so that the username/password are not
transferred over the network unencrypted.
- It is recommended to use HTTPS so that the username/password are not transferred over the network unencrypted.
- If not set then the value of the E(ONE_URL) environment variable is used.
type: str
api_username:
description:
- 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.
- 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.
type: str
api_password:
description:
- 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.
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".
- 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.
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.
type: str
template_name:
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
template_id:
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
vm_start_on_hold:
description:
- Set to true to put vm on hold while creating
- Set to true to put vm on hold while creating.
default: false
type: bool
instance_ids:
@ -67,10 +62,10 @@ options:
state:
description:
- V(present) - create instances from a template specified with C(template_id)/C(template_name).
- V(running) - run instances
- V(poweredoff) - power-off instances
- V(rebooted) - reboot instances
- V(absent) - terminate instances
- V(running) - run instances.
- V(poweredoff) - power-off instances.
- V(rebooted) - reboot instances.
- V(absent) - terminate instances.
choices: ["present", "absent", "running", "rebooted", "poweredoff"]
default: present
type: str
@ -81,64 +76,53 @@ options:
type: bool
wait:
description:
- 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 it
doesn't mean that you will be able to SSH on that machine only that
boot process have started on that instance, see 'wait_for' example for
details.
- 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
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
for details.
default: true
type: bool
wait_timeout:
description:
- How long before wait gives up, in seconds
- How long before wait gives up, in seconds.
default: 300
type: int
attributes:
description:
- A dictionary of key/value attributes to add to new instances, or for
setting C(state) of instances with these attributes.
- A dictionary of key/value attributes to add to new instances, or for setting C(state) of instances with these attributes.
- 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.
- C(#) character(s) can be appended to the C(NAME) and the module will automatically add
indexes to the names of VMs.
- 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.
- 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 indexes to the names of VMs.
- 'For example: V(NAME: foo-###) would create VMs with names V(foo-000), V(foo-001),...'
- When used with O(count_attributes) and O(exact_count) the module will match the base name without the index part.
default: {}
type: dict
labels:
description:
- A list of labels to associate with new instances, or for setting
C(state) of instances with these labels.
- A list of labels to associate with new instances, or for setting C(state) of instances with these labels.
default: []
type: list
elements: str
count_attributes:
description:
- 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 criteria should be deployed. This can be expressed in
multiple ways and is shown in the EXAMPLES section.
- 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
criteria should be deployed. This can be expressed in multiple ways and is shown in the EXAMPLES section.
type: dict
count_labels:
description:
- 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.
This can be expressed in multiple ways and is shown in the EXAMPLES
section.
- 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.
This can be expressed in multiple ways and is shown in the EXAMPLES section.
type: list
elements: str
count:
description:
- Number of instances to launch
- Number of instances to launch.
default: 1
type: int
exact_count:
description:
- Indicates how many instances that match O(count_attributes) and
O(count_labels) parameters should be deployed. Instances are either
created or terminated based on this value.
- 'B(NOTE:) Instances with the least IDs will be terminated first.'
- Indicates how many instances that match O(count_attributes) and O(count_labels) parameters should be deployed. Instances are either created
or terminated based on this value.
- B(NOTE:) Instances with the least IDs will be terminated first.
type: int
mode:
description:
@ -146,27 +130,25 @@ options:
type: str
owner_id:
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
group_id:
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
memory:
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
disk_size:
description:
- 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
matched against the order specified in O(template_id)/O(template_name).'
- 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).
type: list
elements: str
cpu:
description:
- Percentage of CPU divided by 100 required for the new instance. Half a
processor is written 0.5.
- Percentage of CPU divided by 100 required for the new instance. Half a processor is written 0.5.
type: float
vcpu:
description:
@ -183,8 +165,8 @@ options:
- Creates an image from a VM disk.
- 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.
- '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) state.'
- 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)
state.
- Also this operation will fail if an image with specified C(name) already exists.
type: dict
persistent:
@ -195,28 +177,28 @@ options:
version_added: '0.2.0'
datastore_id:
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'
type: int
datastore_name:
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'
type: str
updateconf:
description:
- 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.
type: dict
version_added: 6.3.0
author:
- "Milan Ilic (@ilicmilan)"
- "Jan Meerkamp (@meerkampdvv)"
'''
- "Milan Ilic (@ilicmilan)"
- "Jan Meerkamp (@meerkampdvv)"
"""
EXAMPLES = '''
EXAMPLES = r"""
- name: Create a new instance
community.general.one_vm:
template_id: 90
@ -441,241 +423,219 @@ EXAMPLES = '''
SSH_PUBLIC_KEY: |-
ssh-rsa ...
ssh-ed25519 ...
'''
"""
RETURN = '''
RETURN = r"""
instances_ids:
description: a list of instances ids whose state is changed or which are fetched with O(instance_ids) option.
type: list
returned: success
sample: [ 1234, 1235 ]
description: A list of instances ids whose state is changed or which are fetched with O(instance_ids) option.
type: list
returned: success
sample: [1234, 1235]
instances:
description: a list of instances info whose state is changed or which are fetched with O(instance_ids) option.
type: complex
returned: success
contains:
vm_id:
description: vm id
type: int
sample: 153
vm_name:
description: vm name
type: str
sample: foo
template_id:
description: vm's template id
type: int
sample: 153
group_id:
description: vm's group id
type: int
sample: 1
group_name:
description: vm's group name
type: str
sample: one-users
owner_id:
description: vm's owner id
type: int
sample: 143
owner_name:
description: vm's owner name
type: str
sample: app-user
mode:
description: vm's mode
type: str
returned: success
sample: 660
state:
description: state of an instance
type: str
sample: ACTIVE
lcm_state:
description: lcm state of an instance that is only relevant when the state is ACTIVE
type: str
sample: RUNNING
cpu:
description: Percentage of CPU divided by 100
type: float
sample: 0.2
vcpu:
description: Number of CPUs (cores)
type: int
sample: 2
memory:
description: The size of the memory in MB
type: str
sample: 4096 MB
disk_size:
description: The size of the disk in MB
type: str
sample: 20480 MB
networks:
description: a list of dictionaries with info about IP, NAME, MAC, SECURITY_GROUPS for each NIC
type: list
sample: [
{
"ip": "10.120.5.33",
"mac": "02:00:0a:78:05:21",
"name": "default-test-private",
"security_groups": "0,10"
},
{
"ip": "10.120.5.34",
"mac": "02:00:0a:78:05:22",
"name": "default-test-private",
"security_groups": "0"
}
]
uptime_h:
description: Uptime of the instance in hours
type: int
sample: 35
labels:
description: A list of string labels that are associated with the instance
type: list
sample: [
"foo",
"spec-label"
]
attributes:
description: A dictionary of key/values attributes that are associated with the instance
type: dict
sample: {
"HYPERVISOR": "kvm",
"LOGO": "images/logos/centos.png",
"TE_GALAXY": "bar",
"USER_INPUTS": null
}
updateconf:
description: A dictionary of key/values attributes that are set with the updateconf API call.
type: dict
version_added: 6.3.0
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 ..."
}
}
description: A list of instances info whose state is changed or which are fetched with O(instance_ids) option.
type: complex
returned: success
contains:
vm_id:
description: Vm id.
type: int
sample: 153
vm_name:
description: Vm name.
type: str
sample: foo
template_id:
description: Vm's template id.
type: int
sample: 153
group_id:
description: Vm's group id.
type: int
sample: 1
group_name:
description: Vm's group name.
type: str
sample: one-users
owner_id:
description: Vm's owner id.
type: int
sample: 143
owner_name:
description: Vm's owner name.
type: str
sample: app-user
mode:
description: Vm's mode.
type: str
returned: success
sample: 660
state:
description: State of an instance.
type: str
sample: ACTIVE
lcm_state:
description: Lcm state of an instance that is only relevant when the state is ACTIVE.
type: str
sample: RUNNING
cpu:
description: Percentage of CPU divided by 100.
type: float
sample: 0.2
vcpu:
description: Number of CPUs (cores).
type: int
sample: 2
memory:
description: The size of the memory in MB.
type: str
sample: 4096 MB
disk_size:
description: The size of the disk in MB.
type: str
sample: 20480 MB
networks:
description: A list of dictionaries with info about IP, NAME, MAC, SECURITY_GROUPS for each NIC.
type: list
sample: [
{
"ip": "10.120.5.33",
"mac": "02:00:0a:78:05:21",
"name": "default-test-private",
"security_groups": "0,10"
},
{
"ip": "10.120.5.34",
"mac": "02:00:0a:78:05:22",
"name": "default-test-private",
"security_groups": "0"
}
]
uptime_h:
description: Uptime of the instance in hours.
type: int
sample: 35
labels:
description: A list of string labels that are associated with the instance.
type: list
sample: ["foo", "spec-label"]
attributes:
description: A dictionary of key/values attributes that are associated with the instance.
type: dict
sample: {
"HYPERVISOR": "kvm",
"LOGO": "images/logos/centos.png",
"TE_GALAXY": "bar",
"USER_INPUTS": null
}
updateconf:
description: A dictionary of key/values attributes that are set with the updateconf API call.
type: dict
version_added: 6.3.0
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 ..."
}
}
tagged_instances:
description:
- 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.
type: complex
returned: success
contains:
vm_id:
description: vm id
type: int
sample: 153
vm_name:
description: vm name
type: str
sample: foo
template_id:
description: vm's template id
type: int
sample: 153
group_id:
description: vm's group id
type: int
sample: 1
group_name:
description: vm's group name
type: str
sample: one-users
owner_id:
description: vm's user id
type: int
sample: 143
owner_name:
description: vm's user name
type: str
sample: app-user
mode:
description: vm's mode
type: str
returned: success
sample: 660
state:
description: state of an instance
type: str
sample: ACTIVE
lcm_state:
description: lcm state of an instance that is only relevant when the state is ACTIVE
type: str
sample: RUNNING
cpu:
description: Percentage of CPU divided by 100
type: float
sample: 0.2
vcpu:
description: Number of CPUs (cores)
type: int
sample: 2
memory:
description: The size of the memory in MB
type: str
sample: 4096 MB
disk_size:
description: The size of the disk in MB
type: list
sample: [
"20480 MB",
"10240 MB"
]
networks:
description: a list of dictionaries with info about IP, NAME, MAC, SECURITY_GROUPS for each NIC
type: list
sample: [
{
"ip": "10.120.5.33",
"mac": "02:00:0a:78:05:21",
"name": "default-test-private",
"security_groups": "0,10"
},
{
"ip": "10.120.5.34",
"mac": "02:00:0a:78:05:22",
"name": "default-test-private",
"security_groups": "0"
}
]
uptime_h:
description: Uptime of the instance in hours
type: int
sample: 35
labels:
description: A list of string labels that are associated with the instance
type: list
sample: [
"foo",
"spec-label"
]
attributes:
description: A dictionary of key/values attributes that are associated with the instance
type: dict
sample: {
"HYPERVISOR": "kvm",
"LOGO": "images/logos/centos.png",
"TE_GALAXY": "bar",
"USER_INPUTS": null
}
updateconf:
description: A dictionary of key/values attributes that are set with the updateconf API call
type: dict
version_added: 6.3.0
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 ..."
}
}
'''
description:
- 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.
type: complex
returned: success
contains:
vm_id:
description: Vm id.
type: int
sample: 153
vm_name:
description: Vm name.
type: str
sample: foo
template_id:
description: Vm's template id.
type: int
sample: 153
group_id:
description: Vm's group id.
type: int
sample: 1
group_name:
description: Vm's group name.
type: str
sample: one-users
owner_id:
description: Vm's user id.
type: int
sample: 143
owner_name:
description: Vm's user name.
type: str
sample: app-user
mode:
description: Vm's mode.
type: str
returned: success
sample: 660
state:
description: State of an instance.
type: str
sample: ACTIVE
lcm_state:
description: Lcm state of an instance that is only relevant when the state is ACTIVE.
type: str
sample: RUNNING
cpu:
description: Percentage of CPU divided by 100.
type: float
sample: 0.2
vcpu:
description: Number of CPUs (cores).
type: int
sample: 2
memory:
description: The size of the memory in MB.
type: str
sample: 4096 MB
disk_size:
description: The size of the disk in MB.
type: list
sample: ["20480 MB", "10240 MB"]
networks:
description: A list of dictionaries with info about IP, NAME, MAC, SECURITY_GROUPS for each NIC.
type: list
sample: [
{
"ip": "10.120.5.33",
"mac": "02:00:0a:78:05:21",
"name": "default-test-private",
"security_groups": "0,10"
},
{
"ip": "10.120.5.34",
"mac": "02:00:0a:78:05:22",
"name": "default-test-private",
"security_groups": "0"
}
]
uptime_h:
description: Uptime of the instance in hours.
type: int
sample: 35
labels:
description: A list of string labels that are associated with the instance.
type: list
sample: ["foo", "spec-label"]
attributes:
description: A dictionary of key/values attributes that are associated with the instance.
type: dict
sample: {"HYPERVISOR": "kvm", "LOGO": "images/logos/centos.png", "TE_GALAXY": "bar", "USER_INPUTS": null}
updateconf:
description: A dictionary of key/values attributes that are set with the updateconf API call.
type: dict
version_added: 6.3.0
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 ..."}}
"""
try:
import pyone

View File

@ -9,8 +9,7 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
---
DOCUMENTATION = r"""
module: one_vnet
short_description: Manages OpenNebula virtual networks
version_added: 9.4.0
@ -34,9 +33,8 @@ options:
type: int
name:
description:
- 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 be
managed by this module.
- 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
be managed by this module.
type: str
template:
description:
@ -53,9 +51,9 @@ options:
extends_documentation_fragment:
- community.general.opennebula
- community.general.attributes
'''
"""
EXAMPLES = '''
EXAMPLES = r"""
- name: Make sure the network is present by ID
community.general.one_vnet:
id: 0
@ -87,174 +85,174 @@ EXAMPLES = '''
community.general.one_vnet:
id: 0
state: absent
'''
"""
RETURN = '''
RETURN = r"""
id:
description: The network id.
type: int
returned: when O(state=present)
sample: 153
description: The network id.
type: int
returned: when O(state=present)
sample: 153
name:
description: The network name.
type: str
returned: when O(state=present)
sample: app1
description: The network name.
type: str
returned: when O(state=present)
sample: app1
template:
description: The parsed network template.
type: dict
returned: when O(state=present)
sample:
BRIDGE: onebr.1000
BRIDGE_TYPE: linux
DESCRIPTION: sampletext
PHYDEV: eth0
SECURITY_GROUPS: 0
VLAN_ID: 1000
VN_MAD: 802.1Q
description: The parsed network template.
type: dict
returned: when O(state=present)
sample:
BRIDGE: onebr.1000
BRIDGE_TYPE: linux
DESCRIPTION: sampletext
PHYDEV: eth0
SECURITY_GROUPS: 0
VLAN_ID: 1000
VN_MAD: 802.1Q
user_id:
description: The network's user name.
type: int
returned: when O(state=present)
sample: 1
description: The network's user name.
type: int
returned: when O(state=present)
sample: 1
user_name:
description: The network's user id.
type: str
returned: when O(state=present)
sample: oneadmin
description: The network's user id.
type: str
returned: when O(state=present)
sample: oneadmin
group_id:
description: The network's group id.
type: int
returned: when O(state=present)
sample: 1
description: The network's group id.
type: int
returned: when O(state=present)
sample: 1
group_name:
description: The network's group name.
type: str
returned: when O(state=present)
sample: one-users
description: The network's group name.
type: str
returned: when O(state=present)
sample: one-users
owner_id:
description: The network's owner id.
type: int
returned: when O(state=present)
sample: 143
description: The network's owner id.
type: int
returned: when O(state=present)
sample: 143
owner_name:
description: The network's owner name.
type: str
returned: when O(state=present)
sample: ansible-test
description: The network's owner name.
type: str
returned: when O(state=present)
sample: ansible-test
permissions:
description: The network's permissions.
type: dict
returned: when O(state=present)
contains:
owner_u:
description: The network's owner USAGE permissions.
type: str
sample: 1
owner_m:
description: The network's owner MANAGE permissions.
type: str
sample: 0
owner_a:
description: The network's owner ADMIN permissions.
type: str
sample: 0
group_u:
description: The network's group USAGE permissions.
type: str
sample: 0
group_m:
description: The network's group MANAGE permissions.
type: str
sample: 0
group_a:
description: The network's group ADMIN permissions.
type: str
sample: 0
other_u:
description: The network's other users USAGE permissions.
type: str
sample: 0
other_m:
description: The network's other users MANAGE permissions.
type: str
sample: 0
other_a:
description: The network's other users ADMIN permissions
type: str
sample: 0
sample:
owner_u: 1
owner_m: 0
owner_a: 0
group_u: 0
group_m: 0
group_a: 0
other_u: 0
other_m: 0
other_a: 0
description: The network's permissions.
type: dict
returned: when O(state=present)
contains:
owner_u:
description: The network's owner USAGE permissions.
type: str
sample: 1
owner_m:
description: The network's owner MANAGE permissions.
type: str
sample: 0
owner_a:
description: The network's owner ADMIN permissions.
type: str
sample: 0
group_u:
description: The network's group USAGE permissions.
type: str
sample: 0
group_m:
description: The network's group MANAGE permissions.
type: str
sample: 0
group_a:
description: The network's group ADMIN permissions.
type: str
sample: 0
other_u:
description: The network's other users USAGE permissions.
type: str
sample: 0
other_m:
description: The network's other users MANAGE permissions.
type: str
sample: 0
other_a:
description: The network's other users ADMIN permissions.
type: str
sample: 0
sample:
owner_u: 1
owner_m: 0
owner_a: 0
group_u: 0
group_m: 0
group_a: 0
other_u: 0
other_m: 0
other_a: 0
clusters:
description: The network's clusters.
type: list
returned: when O(state=present)
sample: [0, 100]
description: The network's clusters.
type: list
returned: when O(state=present)
sample: [0, 100]
bridge:
description: The network's bridge interface.
type: str
returned: when O(state=present)
sample: br0
description: The network's bridge interface.
type: str
returned: when O(state=present)
sample: br0
bridge_type:
description: The network's bridge type.
type: str
returned: when O(state=present)
sample: linux
description: The network's bridge type.
type: str
returned: when O(state=present)
sample: linux
parent_network_id:
description: The network's parent network id.
type: int
returned: when O(state=present)
sample: 1
description: The network's parent network id.
type: int
returned: when O(state=present)
sample: 1
vn_mad:
description: The network's VN_MAD.
type: str
returned: when O(state=present)
sample: bridge
description: The network's VN_MAD.
type: str
returned: when O(state=present)
sample: bridge
phydev:
description: The network's physical device (NIC).
type: str
returned: when O(state=present)
sample: eth0
description: The network's physical device (NIC).
type: str
returned: when O(state=present)
sample: eth0
vlan_id:
description: The network's VLAN tag.
type: int
returned: when O(state=present)
sample: 1000
description: The network's VLAN tag.
type: int
returned: when O(state=present)
sample: 1000
outer_vlan_id:
description: The network's outer VLAN tag.
type: int
returned: when O(state=present)
sample: 1000
description: The network's outer VLAN tag.
type: int
returned: when O(state=present)
sample: 1000
vrouters:
description: The network's list of virtual routers IDs.
type: list
returned: when O(state=present)
sample: [0, 1]
description: The network's list of virtual routers IDs.
type: list
returned: when O(state=present)
sample: [0, 1]
ar_pool:
description: The network's list of ar_pool.
type: list
returned: when O(state=present)
sample:
- ar_id: 0
ip: 192.0.2.1
mac: 6c:1e:46:01:cd:d1
size: 20
type: IP4
- ar_id: 1
allocated: 0
ip: 198.51.100.1
mac: 5d:9b:c0:9e:f6:e5
size: 20
type: IP4
'''
description: The network's list of ar_pool.
type: list
returned: when O(state=present)
sample:
- ar_id: 0
ip: 192.0.2.1
mac: 6c:1e:46:01:cd:d1
size: 20
type: IP4
- ar_id: 1
allocated: 0
ip: 198.51.100.1
mac: 5d:9b:c0:9e:f6:e5
size: 20
type: IP4
"""
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
__metaclass__ = type
DOCUMENTATION = '''
---
DOCUMENTATION = r"""
module: oneandone_firewall_policy
short_description: Configure 1&1 firewall policy
description:
- Create, remove, reconfigure, update firewall policies.
This module has a dependency on 1and1 >= 1.0.
- Create, remove, reconfigure, update firewall policies. This module has a dependency on 1and1 >= 1.0.
extends_documentation_fragment:
- community.general.attributes
attributes:
@ -28,21 +26,19 @@ options:
required: false
type: str
default: 'present'
choices: [ "present", "absent", "update" ]
choices: ["present", "absent", "update"]
auth_token:
description:
- Authenticating API token provided by 1&1.
type: str
api_url:
description:
- Custom API URL. Overrides the
ONEANDONE_API_URL environment variable.
- Custom API URL. Overrides the E(ONEANDONE_API_URL) environment variable.
type: str
required: false
name:
description:
- Firewall policy name used with present state. Used as identifier (id or name) when used with absent state.
maxLength=128
- Firewall policy name used with present state. Used as identifier (id or name) when used with absent state. maxLength=128.
type: str
firewall_policy:
description:
@ -50,16 +46,14 @@ options:
type: str
rules:
description:
- A list of rules that will be set for the firewall policy.
Each rule must contain protocol parameter, in addition to three optional parameters
(port_from, port_to, and source)
- A list of rules that will be set for the firewall policy. Each rule must contain protocol parameter, in addition to three optional parameters
(port_from, port_to, and source).
type: list
elements: dict
default: []
add_server_ips:
description:
- A list of server identifiers (id or name) to be assigned to a firewall policy.
Used in combination with update state.
- A list of server identifiers (id or name) to be assigned to a firewall policy. Used in combination with update state.
type: list
elements: str
required: false
@ -73,8 +67,8 @@ options:
default: []
add_rules:
description:
- 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 in combination with update state.
- 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
in combination with update state.
type: list
elements: dict
required: false
@ -88,23 +82,23 @@ options:
default: []
description:
description:
- Firewall policy description. maxLength=256
- Firewall policy description. maxLength=256.
type: str
required: false
wait:
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
default: true
type: bool
wait_timeout:
description:
- how long before wait gives up, in seconds
- How long before wait gives up, in seconds.
type: int
default: 600
wait_interval:
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
default: 5
@ -112,22 +106,21 @@ requirements:
- "1and1"
author:
- "Amel Ajdinovic (@aajdinov)"
- "Ethan Devenport (@edevenport)"
'''
- "Amel Ajdinovic (@aajdinov)"
- "Ethan Devenport (@edevenport)"
"""
EXAMPLES = '''
EXAMPLES = r"""
- name: Create a firewall policy
community.general.oneandone_firewall_policy:
auth_token: oneandone_private_api_key
name: ansible-firewall-policy
description: Testing creation of firewall policies with ansible
rules:
-
protocol: TCP
port_from: 80
port_to: 80
source: 0.0.0.0
- protocol: TCP
port_from: 80
port_to: 80
source: 0.0.0.0
wait: true
wait_timeout: 500
@ -150,8 +143,8 @@ EXAMPLES = '''
auth_token: oneandone_private_api_key
firewall_policy: ansible-firewall-policy-updated
add_server_ips:
- server_identifier (id or name)
- server_identifier #2 (id or name)
- server_identifier (id or name)
- server_identifier #2 (id or name)
wait: true
wait_timeout: 500
state: update
@ -161,7 +154,7 @@ EXAMPLES = '''
auth_token: oneandone_private_api_key
firewall_policy: ansible-firewall-policy-updated
remove_server_ips:
- B2504878540DBC5F7634EB00A07C1EBD (server's IP id)
- B2504878540DBC5F7634EB00A07C1EBD (server's IP id)
wait: true
wait_timeout: 500
state: update
@ -172,16 +165,14 @@ EXAMPLES = '''
firewall_policy: ansible-firewall-policy-updated
description: Adding rules to an existing firewall policy
add_rules:
-
protocol: TCP
port_from: 70
port_to: 70
source: 0.0.0.0
-
protocol: TCP
port_from: 60
port_to: 60
source: 0.0.0.0
- protocol: TCP
port_from: 70
port_to: 70
source: 0.0.0.0
- protocol: TCP
port_from: 60
port_to: 60
source: 0.0.0.0
wait: true
wait_timeout: 500
state: update
@ -191,21 +182,21 @@ EXAMPLES = '''
auth_token: oneandone_private_api_key
firewall_policy: ansible-firewall-policy-updated
remove_rules:
- rule_id #1
- rule_id #2
- ...
- rule_id #1
- rule_id #2
- '...'
wait: true
wait_timeout: 500
state: update
'''
"""
RETURN = '''
RETURN = r"""
firewall_policy:
description: Information about the firewall policy that was processed
type: dict
sample: '{"id": "92B74394A397ECC3359825C1656D67A6", "name": "Default Policy"}'
returned: always
'''
description: Information about the firewall policy that was processed.
type: dict
sample: '{"id": "92B74394A397ECC3359825C1656D67A6", "name": "Default Policy"}'
returned: always
"""
import os
from ansible.module_utils.basic import AnsibleModule

View File

@ -7,13 +7,11 @@
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
DOCUMENTATION = r"""
module: oneandone_load_balancer
short_description: Configure 1&1 load balancer
description:
- Create, remove, update load balancers.
This module has a dependency on 1and1 >= 1.0.
- Create, remove, update load balancers. This module has a dependency on 1and1 >= 1.0.
extends_documentation_fragment:
- community.general.attributes
attributes:
@ -28,7 +26,7 @@ options:
type: str
required: false
default: 'present'
choices: [ "present", "absent", "update" ]
choices: ["present", "absent", "update"]
auth_token:
description:
- Authenticating API token provided by 1&1.
@ -39,32 +37,30 @@ options:
type: str
api_url:
description:
- Custom API URL. Overrides the
E(ONEANDONE_API_URL) environment variable.
- Custom API URL. Overrides the E(ONEANDONE_API_URL) environment variable.
type: str
required: false
name:
description:
- Load balancer name used with present state. Used as identifier (id or name) when used with absent state.
maxLength=128
- Load balancer name used with present state. Used as identifier (id or name) when used with absent state. maxLength=128.
type: str
health_check_test:
description:
- Type of the health check. At the moment, HTTP is not allowed.
type: str
choices: [ "NONE", "TCP", "HTTP", "ICMP" ]
choices: ["NONE", "TCP", "HTTP", "ICMP"]
health_check_interval:
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
health_check_path:
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
required: false
health_check_parse:
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
required: false
persistence:
@ -73,36 +69,35 @@ options:
type: bool
persistence_time:
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
method:
description:
- Balancing procedure.
type: str
choices: [ "ROUND_ROBIN", "LEAST_CONNECTIONS" ]
choices: ["ROUND_ROBIN", "LEAST_CONNECTIONS"]
datacenter:
description:
- ID or country code of the datacenter where the load balancer will be created.
- If not specified, it defaults to V(US).
type: str
choices: [ "US", "ES", "DE", "GB" ]
choices: ["US", "ES", "DE", "GB"]
required: false
rules:
description:
- A list of rule objects that will be set for the load balancer. Each rule must contain protocol,
port_balancer, and port_server parameters, in addition to source parameter, which is optional.
- A list of rule objects that will be set for the load balancer. Each rule must contain protocol, port_balancer, and port_server parameters,
in addition to source parameter, which is optional.
type: list
elements: dict
default: []
description:
description:
- Description of the load balancer. maxLength=256
- Description of the load balancer. maxLength=256.
type: str
required: false
add_server_ips:
description:
- A list of server identifiers (id or name) to be assigned to a load balancer.
Used in combination with update state.
- A list of server identifiers (id or name) to be assigned to a load balancer. Used in combination with update state.
type: list
elements: str
required: false
@ -116,8 +111,8 @@ options:
default: []
add_rules:
description:
- 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 combination with update state.
- 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
combination with update state.
type: list
elements: dict
required: false
@ -131,30 +126,30 @@ options:
default: []
wait:
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
default: true
type: bool
wait_timeout:
description:
- how long before wait gives up, in seconds
- How long before wait gives up, in seconds.
type: int
default: 600
wait_interval:
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
default: 5
requirements:
- "1and1"
- "1and1"
author:
- Amel Ajdinovic (@aajdinov)
- Ethan Devenport (@edevenport)
'''
"""
EXAMPLES = '''
EXAMPLES = r"""
- name: Create a load balancer
community.general.oneandone_load_balancer:
auth_token: oneandone_private_api_key
@ -167,11 +162,10 @@ EXAMPLES = '''
method: ROUND_ROBIN
datacenter: US
rules:
-
protocol: TCP
port_balancer: 80
port_server: 80
source: 0.0.0.0
- protocol: TCP
port_balancer: 80
port_server: 80
source: 0.0.0.0
wait: true
wait_timeout: 500
@ -199,7 +193,7 @@ EXAMPLES = '''
load_balancer: ansible load balancer updated
description: Adding server to a load balancer with ansible
add_server_ips:
- server identifier (id or name)
- server identifier (id or name)
wait: true
wait_timeout: 500
state: update
@ -210,7 +204,7 @@ EXAMPLES = '''
load_balancer: ansible load balancer updated
description: Removing server from a load balancer with ansible
remove_server_ips:
- B2504878540DBC5F7634EB00A07C1EBD (server's ip id)
- B2504878540DBC5F7634EB00A07C1EBD (server's ip id)
wait: true
wait_timeout: 500
state: update
@ -221,16 +215,14 @@ EXAMPLES = '''
load_balancer: ansible load balancer updated
description: Adding rules to a load balancer with ansible
add_rules:
-
protocol: TCP
port_balancer: 70
port_server: 70
source: 0.0.0.0
-
protocol: TCP
port_balancer: 60
port_server: 60
source: 0.0.0.0
- protocol: TCP
port_balancer: 70
port_server: 70
source: 0.0.0.0
- protocol: TCP
port_balancer: 60
port_server: 60
source: 0.0.0.0
wait: true
wait_timeout: 500
state: update
@ -241,21 +233,21 @@ EXAMPLES = '''
load_balancer: ansible load balancer updated
description: Adding rules to a load balancer with ansible
remove_rules:
- rule_id #1
- rule_id #2
- ...
- rule_id #1
- rule_id #2
- '...'
wait: true
wait_timeout: 500
state: update
'''
"""
RETURN = '''
RETURN = r"""
load_balancer:
description: Information about the load balancer that was processed
type: dict
sample: '{"id": "92B74394A397ECC3359825C1656D67A6", "name": "Default Balancer"}'
returned: always
'''
description: Information about the load balancer that was processed.
type: dict
sample: '{"id": "92B74394A397ECC3359825C1656D67A6", "name": "Default Balancer"}'
returned: always
"""
import os
from ansible.module_utils.basic import AnsibleModule

View File

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

View File

@ -7,13 +7,11 @@
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
DOCUMENTATION = r"""
module: oneandone_private_network
short_description: Configure 1&1 private networking
description:
- Create, remove, reconfigure, update a private network.
This module has a dependency on 1and1 >= 1.0.
- Create, remove, reconfigure, update a private network. This module has a dependency on 1and1 >= 1.0.
extends_documentation_fragment:
- community.general.attributes
attributes:
@ -28,7 +26,7 @@ options:
type: str
required: false
default: 'present'
choices: [ "present", "absent", "update" ]
choices: ["present", "absent", "update"]
auth_token:
description:
- Authenticating API token provided by 1&1.
@ -39,8 +37,7 @@ options:
type: str
api_url:
description:
- Custom API URL. Overrides the
ONEANDONE_API_URL environment variable.
- Custom API URL. Overrides the E(ONEANDONE_API_URL) environment variable.
type: str
required: false
name:
@ -53,16 +50,16 @@ options:
type: str
datacenter:
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
choices: [US, ES, DE, GB]
network_address:
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
subnet_mask:
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
add_members:
description:
@ -78,30 +75,30 @@ options:
default: []
wait:
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
default: true
type: bool
wait_timeout:
description:
- how long before wait gives up, in seconds
- How long before wait gives up, in seconds.
type: int
default: 600
wait_interval:
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
default: 5
requirements:
- "1and1"
- "1and1"
author:
- Amel Ajdinovic (@aajdinov)
- Ethan Devenport (@edevenport)
'''
"""
EXAMPLES = '''
EXAMPLES = r"""
- name: Create a private network
community.general.oneandone_private_network:
auth_token: oneandone_private_api_key
@ -131,7 +128,7 @@ EXAMPLES = '''
state: update
private_network: backup_network
add_members:
- server identifier (id or name)
- server identifier (id or name)
- name: Remove members from the private network
community.general.oneandone_private_network:
@ -139,16 +136,16 @@ EXAMPLES = '''
state: update
private_network: backup_network
remove_members:
- server identifier (id or name)
'''
- server identifier (id or name)
"""
RETURN = '''
RETURN = r"""
private_network:
description: Information about the private network.
type: dict
sample: '{"name": "backup_network", "id": "55726DEDA20C99CF6F2AF8F18CAC9963"}'
returned: always
'''
description: Information about the private network.
type: dict
sample: '{"name": "backup_network", "id": "55726DEDA20C99CF6F2AF8F18CAC9963"}'
returned: always
"""
import os
from ansible.module_utils.basic import AnsibleModule

View File

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

View File

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

View File

@ -12,108 +12,108 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = '''
DOCUMENTATION = r"""
module: onepassword_info
author:
- Ryan Conway (@Rylon)
- Ryan Conway (@Rylon)
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:
- Tested with C(op) version 0.5.5
- "Based on the P(community.general.onepassword#lookup) lookup plugin by Scott Buchanan <sbuchanan@ri.pn>."
- Tested with C(op) version 0.5.5.
- Based on the P(community.general.onepassword#lookup) lookup plugin by Scott Buchanan <sbuchanan@ri.pn>.
short_description: Gather items from 1Password
description:
- M(community.general.onepassword_info) wraps the C(op) command line utility to fetch data about one or more 1Password items.
- A fatal error occurs if any of the items being searched for can not be found.
- Recommend using with the C(no_log) option to avoid logging the values of the secrets being retrieved.
- M(community.general.onepassword_info) wraps the C(op) command line utility to fetch data about one or more 1Password items.
- A fatal error occurs if any of the items being searched for can not be found.
- Recommend using with the C(no_log) option to avoid logging the values of the secrets being retrieved.
extends_documentation_fragment:
- community.general.attributes
- community.general.attributes.info_module
- community.general.attributes
- community.general.attributes.info_module
options:
search_terms:
type: list
elements: dict
search_terms:
type: list
elements: dict
description:
- A list of one or more search terms.
- Each search term can either be a simple string or it can be a dictionary for more control.
- When passing a simple string, O(search_terms[].field) is assumed to be V(password).
- When passing a dictionary, the following fields are available.
suboptions:
name:
type: str
description:
- A list of one or more search terms.
- Each search term can either be a simple string or it can be a dictionary for more control.
- When passing a simple string, O(search_terms[].field) is assumed to be V(password).
- When passing a dictionary, the following fields are available.
suboptions:
name:
type: str
description:
- The name of the 1Password item to search for (required).
field:
type: str
description:
- The name of the field to search for within this item (optional, defaults to "password" (or "document" if the item has an attachment).
section:
type: str
description:
- The name of a section within this item containing the specified field (optional, will search all sections if not specified).
vault:
type: str
description:
- The name of the particular 1Password vault to search, useful if your 1Password user has access to multiple vaults (optional).
- The name of the 1Password item to search for (required).
field:
type: str
description:
- 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:
type: str
description:
- The name of a section within this item containing the specified field (optional, will search all sections if not specified).
vault:
type: str
description:
- The name of the particular 1Password vault to search, useful if your 1Password user has access to multiple vaults (optional).
required: true
auto_login:
type: dict
description:
- A dictionary containing authentication details. If this is set, M(community.general.onepassword_info) will attempt to sign in to 1Password
automatically.
- 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 the Ansible Vault
is equal to or greater in strength than the 1Password master password.
suboptions:
subdomain:
type: str
description:
- 1Password subdomain name (V(subdomain).1password.com).
- If this is not specified, the most recent subdomain will be used.
username:
type: str
description:
- 1Password username.
- Only required for initial sign in.
master_password:
type: str
description:
- The master password for your subdomain.
- This is always required when specifying O(auto_login).
required: true
auto_login:
type: dict
secret_key:
type: str
description:
- A dictionary containing authentication details. If this is set, M(community.general.onepassword_info)
will attempt to sign in to 1Password automatically.
- Without this option, you must have already logged in via 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
the Ansible Vault is equal to or greater in strength than the 1Password master password.
suboptions:
subdomain:
type: str
description:
- 1Password subdomain name (<subdomain>.1password.com).
- If this is not specified, the most recent subdomain will be used.
username:
type: str
description:
- 1Password username.
- Only required for initial sign in.
master_password:
type: str
description:
- The master password for your subdomain.
- This is always required when specifying O(auto_login).
required: true
secret_key:
type: str
description:
- The secret key for your subdomain.
- Only required for initial sign in.
required: false
cli_path:
type: path
description: Used to specify the exact path to the C(op) command line interface
required: false
default: 'op'
'''
- The secret key for your subdomain.
- Only required for initial sign in.
required: false
cli_path:
type: path
description: Used to specify the exact path to the C(op) command line interface.
required: false
default: 'op'
"""
EXAMPLES = '''
EXAMPLES = r"""
# Gather secrets from 1Password, assuming there is a 'password' field:
- name: Get a password
community.general.onepassword_info:
search_terms: My 1Password item
delegate_to: localhost
register: my_1password_item
no_log: true # Don't want to log the secrets to the console!
no_log: true # Don't want to log the secrets to the console!
# Gather secrets from 1Password, with more advanced search terms:
- name: Get a password
community.general.onepassword_info:
search_terms:
- name: My 1Password item
field: Custom field name # optional, defaults to 'password'
section: Custom section name # optional, defaults to 'None'
vault: Name of the vault # optional, only necessary if there is more than 1 Vault available
- name: My 1Password item
field: Custom field name # optional, defaults to 'password'
section: Custom section name # optional, defaults to 'None'
vault: Name of the vault # optional, only necessary if there is more than 1 Vault available
delegate_to: localhost
register: my_1password_item
no_log: true # Don't want to log the secrets to the console!
no_log: true # Don't want to log the secrets to the console!
# Gather secrets combining simple and advanced search terms to retrieve two items, one of which we fetch two
# fields. In the first 'password' is fetched, as a field name is not specified (default behaviour) and in the
@ -121,39 +121,38 @@ EXAMPLES = '''
- name: Get a password
community.general.onepassword_info:
search_terms:
- My 1Password item # 'name' is optional when passing a simple string...
- name: My Other 1Password item # ...but it can also be set for consistency
- name: My 1Password item
field: Custom field name # optional, defaults to 'password'
section: Custom section name # optional, defaults to 'None'
vault: Name of the vault # optional, only necessary if there is more than 1 Vault available
- My 1Password item # 'name' is optional when passing a simple string...
- name: My Other 1Password item # ...but it can also be set for consistency
- name: My 1Password item
field: Custom field name # optional, defaults to 'password'
section: Custom section name # optional, defaults to 'None'
vault: Name of the vault # optional, only necessary if there is more than 1 Vault available
- name: A 1Password item with document attachment
delegate_to: localhost
register: my_1password_item
no_log: true # Don't want to log the secrets to the console!
no_log: true # Don't want to log the secrets to the console!
- name: Debug a password (for example)
ansible.builtin.debug:
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.
# This shows the response you would expect to receive from the third example documented above.
onepassword:
description: Dictionary of each 1password item matching the given search terms, shows what would be returned from the third example above.
returned: success
type: dict
sample:
"My 1Password item":
password: the value of this field
Custom field name: the value of this field
"My Other 1Password item":
password: the value of this field
"A 1Password item with document attachment":
document: the contents of the document attached to this item
'''
description: Dictionary of each 1password item matching the given search terms, shows what would be returned from the third example above.
returned: success
type: dict
sample:
"My 1Password item":
password: the value of this field
Custom field name: the value of this field
"My Other 1Password item":
password: the value of this field
"A 1Password item with document attachment":
document: the contents of the document attached to this item
"""
import errno