[PR #9372/bef82e28 backport][stable-9] p[a-e]*: normalize docs (#9396)

p[a-e]*: normalize docs (#9372)

* p[a-e]*: normalize docs

* Update plugins/modules/packet_volume.py

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

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit bef82e28a2)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
pull/9410/head
patchback[bot] 2024-12-26 08:39:12 +01:00 committed by GitHub
parent b8968c5c1c
commit c64705474d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 867 additions and 945 deletions

View File

@ -8,71 +8,59 @@
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: pacemaker_cluster module: pacemaker_cluster
short_description: Manage pacemaker clusters short_description: Manage pacemaker clusters
author: author:
- Mathieu Bultel (@matbu) - Mathieu Bultel (@matbu)
description: description:
- This module can manage a pacemaker cluster and nodes from Ansible using - This module can manage a pacemaker cluster and nodes from Ansible using the pacemaker CLI.
the pacemaker cli.
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
attributes: attributes:
check_mode: check_mode:
support: full support: full
diff_mode: diff_mode:
support: none support: none
options: options:
state: state:
description: description:
- Indicate desired state of the cluster - Indicate desired state of the cluster.
choices: [ cleanup, offline, online, restart ] choices: [cleanup, offline, online, restart]
type: str type: str
node: node:
description: description:
- Specify which node of the cluster you want to manage. None == the - Specify which node of the cluster you want to manage. V(null) == the cluster status itself, V(all) == check the status of all nodes.
cluster status itself, 'all' == check the status of all nodes. type: str
type: str timeout:
timeout: description:
description: - Timeout when the module should considered that the action has failed.
- Timeout when the module should considered that the action has failed default: 300
default: 300 type: int
type: int force:
force: description:
description: - Force the change of the cluster state.
- Force the change of the cluster state type: bool
type: bool default: true
default: true """
'''
EXAMPLES = ''' EXAMPLES = r"""
---
- name: Set cluster Online - name: Set cluster Online
hosts: localhost hosts: localhost
gather_facts: false gather_facts: false
tasks: tasks:
- name: Get cluster state - name: Get cluster state
community.general.pacemaker_cluster: community.general.pacemaker_cluster:
state: online state: online
''' """
RETURN = ''' RETURN = r"""
changed:
description: true if the cluster state has changed
type: bool
returned: always
out: out:
description: The output of the current state of the cluster. It return a description: The output of the current state of the cluster. It returns a list of the nodes state.
list of the nodes state. type: str
type: str sample: 'out: [[" overcloud-controller-0", " Online"]]}'
sample: 'out: [[" overcloud-controller-0", " Online"]]}' returned: always
returned: always """
rc:
description: exit code of the module
type: bool
returned: always
'''
import time import time

View File

@ -10,26 +10,23 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: packet_device module: packet_device
short_description: Manage a bare metal server in the Packet Host short_description: Manage a bare metal server in the Packet Host
description: description:
- Manage a bare metal server in the Packet Host (a "device" in the API terms). - Manage a bare metal server in the Packet Host (a "device" in the API terms).
- When the machine is created it can optionally wait for public IP address, or for active state. - When the machine is created it can optionally wait for public IP address, or for active state.
- This module has a dependency on packet >= 1.0. - This module has a dependency on packet >= 1.0.
- API is documented at U(https://www.packet.net/developers/api/devices). - API is documented at U(https://www.packet.net/developers/api/devices).
author: author:
- Tomas Karasek (@t0mk) <tom.to.the.k@gmail.com> - Tomas Karasek (@t0mk) <tom.to.the.k@gmail.com>
- Matt Baldwin (@baldwinSPC) <baldwin@stackpointcloud.com> - Matt Baldwin (@baldwinSPC) <baldwin@stackpointcloud.com>
- Thibaud Morel l'Horset (@teebes) <teebes@gmail.com> - Thibaud Morel l'Horset (@teebes) <teebes@gmail.com>
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
attributes: attributes:
check_mode: check_mode:
@ -45,7 +42,7 @@ options:
count: count:
description: description:
- The number of devices to create. Count number can be included in hostname via the %d string formatter. - The number of devices to create. Count number can be included in hostname using the C(%d) string formatter.
default: 1 default: 1
type: int type: int
@ -122,7 +119,7 @@ options:
user_data: user_data:
description: description:
- Userdata blob made available to the machine - Userdata blob made available to the machine.
type: str type: str
wait_for_public_IPv: wait_for_public_IPv:
@ -130,7 +127,7 @@ options:
- Whether to wait for the instance to be assigned a public IPv4/IPv6 address. - Whether to wait for the instance to be assigned a public IPv4/IPv6 address.
- If set to 4, it will wait until IPv4 is assigned to the instance. - If set to 4, it will wait until IPv4 is assigned to the instance.
- If set to 6, wait until public IPv6 is assigned to the instance. - If set to 6, wait until public IPv6 is assigned to the instance.
choices: [4,6] choices: [4, 6]
type: int type: int
wait_timeout: wait_timeout:
@ -156,11 +153,10 @@ options:
requirements: requirements:
- "packet-python >= 1.35" - "packet-python >= 1.35"
"""
''' EXAMPLES = r"""
EXAMPLES = '''
# All the examples assume that you have your Packet API token in environment variable PACKET_API_TOKEN. # All the examples assume that you have your Packet API token in environment variable PACKET_API_TOKEN.
# You can also pass it to the auth_token parameter of the module instead. # You can also pass it to the auth_token parameter of the module instead.
@ -169,13 +165,13 @@ EXAMPLES = '''
- name: Create 1 device - name: Create 1 device
hosts: localhost hosts: localhost
tasks: tasks:
- community.general.packet_device: - community.general.packet_device:
project_id: 89b497ee-5afc-420a-8fb5-56984898f4df project_id: 89b497ee-5afc-420a-8fb5-56984898f4df
hostnames: myserver hostnames: myserver
tags: ci-xyz tags: ci-xyz
operating_system: ubuntu_16_04 operating_system: ubuntu_16_04
plan: baremetal_0 plan: baremetal_0
facility: sjc1 facility: sjc1
# Create the same device and wait until it is in state "active", (when it's # Create the same device and wait until it is in state "active", (when it's
# ready for other API operations). Fail if the device is not "active" in # ready for other API operations). Fail if the device is not "active" in
@ -184,64 +180,64 @@ EXAMPLES = '''
- name: Create device and wait up to 10 minutes for active state - name: Create device and wait up to 10 minutes for active state
hosts: localhost hosts: localhost
tasks: tasks:
- community.general.packet_device: - community.general.packet_device:
project_id: 89b497ee-5afc-420a-8fb5-56984898f4df project_id: 89b497ee-5afc-420a-8fb5-56984898f4df
hostnames: myserver hostnames: myserver
operating_system: ubuntu_16_04 operating_system: ubuntu_16_04
plan: baremetal_0 plan: baremetal_0
facility: sjc1 facility: sjc1
state: active state: active
wait_timeout: 600 wait_timeout: 600
- name: Create 3 ubuntu devices called server-01, server-02 and server-03 - name: Create 3 ubuntu devices called server-01, server-02 and server-03
hosts: localhost hosts: localhost
tasks: tasks:
- community.general.packet_device: - community.general.packet_device:
project_id: 89b497ee-5afc-420a-8fb5-56984898f4df project_id: 89b497ee-5afc-420a-8fb5-56984898f4df
hostnames: server-%02d hostnames: server-%02d
count: 3 count: 3
operating_system: ubuntu_16_04 operating_system: ubuntu_16_04
plan: baremetal_0 plan: baremetal_0
facility: sjc1 facility: sjc1
- name: Create 3 coreos devices with userdata, wait until they get IPs and then wait for SSH - name: Create 3 coreos devices with userdata, wait until they get IPs and then wait for SSH
hosts: localhost hosts: localhost
tasks: tasks:
- name: Create 3 devices and register their facts - name: Create 3 devices and register their facts
community.general.packet_device: community.general.packet_device:
hostnames: [coreos-one, coreos-two, coreos-three] hostnames: [coreos-one, coreos-two, coreos-three]
operating_system: coreos_stable operating_system: coreos_stable
plan: baremetal_0 plan: baremetal_0
facility: ewr1 facility: ewr1
locked: true locked: true
project_id: 89b497ee-5afc-420a-8fb5-56984898f4df project_id: 89b497ee-5afc-420a-8fb5-56984898f4df
wait_for_public_IPv: 4 wait_for_public_IPv: 4
user_data: | user_data: |
#cloud-config #cloud-config
ssh_authorized_keys: ssh_authorized_keys:
- {{ lookup('file', 'my_packet_sshkey') }} - {{ lookup('file', 'my_packet_sshkey') }}
coreos: coreos:
etcd: etcd:
discovery: https://discovery.etcd.io/6a28e078895c5ec737174db2419bb2f3 discovery: https://discovery.etcd.io/6a28e078895c5ec737174db2419bb2f3
addr: $private_ipv4:4001 addr: $private_ipv4:4001
peer-addr: $private_ipv4:7001 peer-addr: $private_ipv4:7001
fleet: fleet:
public-ip: $private_ipv4 public-ip: $private_ipv4
units: units:
- name: etcd.service - name: etcd.service
command: start command: start
- name: fleet.service - name: fleet.service
command: start command: start
register: newhosts register: newhosts
- name: Wait for ssh - name: Wait for ssh
ansible.builtin.wait_for: ansible.builtin.wait_for:
delay: 1 delay: 1
host: "{{ item.public_ipv4 }}" host: "{{ item.public_ipv4 }}"
port: 22 port: 22
state: started state: started
timeout: 500 timeout: 500
with_items: "{{ newhosts.devices }}" with_items: "{{ newhosts.devices }}"
# Other states of devices # Other states of devices
@ -249,38 +245,38 @@ EXAMPLES = '''
- name: Remove 3 devices by uuid - name: Remove 3 devices by uuid
hosts: localhost hosts: localhost
tasks: tasks:
- community.general.packet_device: - community.general.packet_device:
project_id: 89b497ee-5afc-420a-8fb5-56984898f4df project_id: 89b497ee-5afc-420a-8fb5-56984898f4df
state: absent state: absent
device_ids: device_ids:
- 1fb4faf8-a638-4ac7-8f47-86fe514c30d8 - 1fb4faf8-a638-4ac7-8f47-86fe514c30d8
- 2eb4faf8-a638-4ac7-8f47-86fe514c3043 - 2eb4faf8-a638-4ac7-8f47-86fe514c3043
- 6bb4faf8-a638-4ac7-8f47-86fe514c301f - 6bb4faf8-a638-4ac7-8f47-86fe514c301f
''' """
RETURN = ''' RETURN = r"""
changed: changed:
description: True if a device was altered in any way (created, modified or removed) description: True if a device was altered in any way (created, modified or removed).
type: bool type: bool
sample: true sample: true
returned: success returned: success
devices: devices:
description: Information about each device that was processed description: Information about each device that was processed
type: list type: list
sample: sample:
- { - {
"hostname": "my-server.com", "hostname": "my-server.com",
"id": "2a5122b9-c323-4d5c-b53c-9ad3f54273e7", "id": "2a5122b9-c323-4d5c-b53c-9ad3f54273e7",
"public_ipv4": "147.229.15.12", "public_ipv4": "147.229.15.12",
"private-ipv4": "10.0.15.12", "private-ipv4": "10.0.15.12",
"tags": [], "tags": [],
"locked": false, "locked": false,
"state": "provisioning", "state": "provisioning",
"public_ipv6": "2604:1380:2:5200::3" "public_ipv6": "2604:1380:2:5200::3"
} }
returned: success returned: success
''' # NOQA """
import os import os

View File

@ -10,26 +10,24 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: packet_ip_subnet module: packet_ip_subnet
short_description: Assign IP subnet to a bare metal server short_description: Assign IP subnet to a bare metal server
description: description:
- Assign or unassign IPv4 or IPv6 subnets to or from a device in the Packet host. - Assign or unassign IPv4 or IPv6 subnets to or from a device in the Packet host.
- IPv4 subnets must come from already reserved block. - IPv4 subnets must come from already reserved block.
- IPv6 subnets must come from publicly routable /56 block from your project. - IPv6 subnets must come from publicly routable /56 block from your project.
- See U(https://support.packet.com/kb/articles/elastic-ips) for more info on IP block reservation. - See U(https://support.packet.com/kb/articles/elastic-ips) for more info on IP block reservation.
version_added: '0.2.0' version_added: '0.2.0'
author: author:
- Tomas Karasek (@t0mk) <tom.to.the.k@gmail.com> - Tomas Karasek (@t0mk) <tom.to.the.k@gmail.com>
- Nurfet Becirevic (@nurfet-becirevic) <nurfet.becirevic@gmail.com> - Nurfet Becirevic (@nurfet-becirevic) <nurfet.becirevic@gmail.com>
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
attributes: attributes:
check_mode: check_mode:
@ -77,7 +75,8 @@ options:
state: state:
description: description:
- Desired state of the IP subnet on the specified device. - Desired state of the IP subnet on the specified device.
- With O(state=present), you must specify either O(hostname) or O(device_id). Subnet with given CIDR will then be assigned to the specified device. - With O(state=present), you must specify either O(hostname) or O(device_id). Subnet with given CIDR will then be assigned to the specified
device.
- With O(state=absent), you can specify either O(hostname) or O(device_id). The subnet will be removed from specified devices. - With O(state=absent), you can specify either O(hostname) or O(device_id). The subnet will be removed from specified devices.
- If you leave both O(hostname) and O(device_id) empty, the subnet will be removed from any device it's assigned to. - If you leave both O(hostname) and O(device_id) empty, the subnet will be removed from any device it's assigned to.
choices: ['present', 'absent'] choices: ['present', 'absent']
@ -85,10 +84,10 @@ options:
type: str type: str
requirements: requirements:
- "packet-python >= 1.35" - "packet-python >= 1.35"
''' """
EXAMPLES = ''' EXAMPLES = r"""
# All the examples assume that you have your Packet API token in env var PACKET_API_TOKEN. # All the examples assume that you have your Packet API token in env var PACKET_API_TOKEN.
# You can also pass it to the auth_token parameter of the module instead. # You can also pass it to the auth_token parameter of the module instead.
@ -96,33 +95,33 @@ EXAMPLES = '''
hosts: localhost hosts: localhost
tasks: tasks:
- packet_device: - packet_device:
project_id: 89b497ee-5afc-420a-8fb5-56984898f4df project_id: 89b497ee-5afc-420a-8fb5-56984898f4df
hostnames: myserver hostnames: myserver
operating_system: ubuntu_16_04 operating_system: ubuntu_16_04
plan: baremetal_0 plan: baremetal_0
facility: sjc1 facility: sjc1
state: active state: active
# Pick an IPv4 address from a block allocated to your project. # Pick an IPv4 address from a block allocated to your project.
- community.general.packet_ip_subnet: - community.general.packet_ip_subnet:
project_id: 89b497ee-5afc-420a-8fb5-56984898f4df project_id: 89b497ee-5afc-420a-8fb5-56984898f4df
hostname: myserver hostname: myserver
cidr: "147.75.201.78/32" cidr: "147.75.201.78/32"
# Release IP address 147.75.201.78 # Release IP address 147.75.201.78
- name: Unassign IP address from any device in your project - name: Unassign IP address from any device in your project
hosts: localhost hosts: localhost
tasks: tasks:
- community.general.packet_ip_subnet: - community.general.packet_ip_subnet:
project_id: 89b497ee-5afc-420a-8fb5-56984898f4df project_id: 89b497ee-5afc-420a-8fb5-56984898f4df
cidr: "147.75.201.78/32" cidr: "147.75.201.78/32"
state: absent state: absent
''' """
RETURN = ''' RETURN = r"""
changed: changed:
description: True if an IP address assignments were altered in any way (created or removed). description: True if an IP address assignments were altered in any way (created or removed).
type: bool type: bool
@ -140,7 +139,7 @@ subnet:
sample: sample:
address: 147.75.90.241 address: 147.75.90.241
address_family: 4 address_family: 4
assigned_to: { href : /devices/61f9aa5e-0530-47f5-97c2-113828e61ed0 } assigned_to: {href: /devices/61f9aa5e-0530-47f5-97c2-113828e61ed0}
cidr: 31 cidr: 31
created_at: '2017-08-07T15:15:30Z' created_at: '2017-08-07T15:15:30Z'
enabled: true enabled: true
@ -153,7 +152,7 @@ subnet:
network: 147.75.90.240 network: 147.75.90.240
public: true public: true
returned: success returned: success
''' """
import uuid import uuid

View File

@ -10,24 +10,22 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: packet_project module: packet_project
short_description: Create/delete a project in Packet host short_description: Create/delete a project in Packet host
description: description:
- Create/delete a project in Packet host. - Create/delete a project in Packet host.
- API is documented at U(https://www.packet.com/developers/api/#projects). - API is documented at U(https://www.packet.com/developers/api/#projects).
version_added: '0.2.0' version_added: '0.2.0'
author: author:
- Tomas Karasek (@t0mk) <tom.to.the.k@gmail.com> - Tomas Karasek (@t0mk) <tom.to.the.k@gmail.com>
- Nurfet Becirevic (@nurfet-becirevic) <nurfet.becirevic@gmail.com> - Nurfet Becirevic (@nurfet-becirevic) <nurfet.becirevic@gmail.com>
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
attributes: attributes:
check_mode: check_mode:
@ -55,9 +53,9 @@ options:
type: str type: str
name: name:
description: description:
- Name for/of the project. - Name for/of the project.
type: str type: str
org_id: org_id:
description: description:
@ -76,11 +74,10 @@ options:
type: str type: str
requirements: requirements:
- "packet-python >= 1.40" - "packet-python >= 1.40"
"""
''' EXAMPLES = r"""
EXAMPLES = '''
# All the examples assume that you have your Packet API token in env var PACKET_API_TOKEN. # All the examples assume that you have your Packet API token in env var PACKET_API_TOKEN.
# You can also pass the api token in module param auth_token. # You can also pass the api token in module param auth_token.
@ -110,9 +107,9 @@ EXAMPLES = '''
community.general.packet_project: community.general.packet_project:
name: "newer project" name: "newer project"
payment_method: "the other visa" payment_method: "the other visa"
''' """
RETURN = ''' RETURN = r"""
changed: changed:
description: True if a project was created or removed. description: True if a project was created or removed.
type: bool type: bool
@ -128,7 +125,7 @@ id:
description: UUID of addressed project. description: UUID of addressed project.
type: str type: str
returned: success returned: success
''' """
from ansible.module_utils.basic import AnsibleModule, env_fallback from ansible.module_utils.basic import AnsibleModule, env_fallback
from ansible.module_utils.common.text.converters import to_native from ansible.module_utils.common.text.converters import to_native

View File

@ -8,13 +8,12 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: packet_sshkey module: packet_sshkey
short_description: Create/delete an SSH key in Packet host short_description: Create/delete an SSH key in Packet host
description: description:
- Create/delete an SSH key in Packet host. - Create/delete an SSH key in Packet host.
- API is documented at U(https://www.packet.net/help/api/#page:ssh-keys,header:ssh-keys-ssh-keys-post). - API is documented at U(https://www.packet.net/help/api/#page:ssh-keys,header:ssh-keys-ssh-keys-post).
author: "Tomas Karasek (@t0mk) <tom.to.the.k@gmail.com>" author: "Tomas Karasek (@t0mk) <tom.to.the.k@gmail.com>"
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
@ -26,42 +25,41 @@ attributes:
options: options:
state: state:
description: description:
- Indicate desired state of the target. - Indicate desired state of the target.
default: present default: present
choices: ['present', 'absent'] choices: ['present', 'absent']
type: str type: str
auth_token: auth_token:
description: description:
- Packet API token. You can also supply it in environment variable E(PACKET_API_TOKEN). - Packet API token. You can also supply it in environment variable E(PACKET_API_TOKEN).
type: str type: str
label: label:
description: description:
- Label for the key. If you keep it empty, it will be read from key string. - Label for the key. If you keep it empty, it will be read from key string.
type: str type: str
aliases: [name] aliases: [name]
id: id:
description: description:
- UUID of the key which you want to remove. - UUID of the key which you want to remove.
type: str type: str
fingerprint: fingerprint:
description: description:
- Fingerprint of the key which you want to remove. - Fingerprint of the key which you want to remove.
type: str type: str
key: key:
description: description:
- Public Key string ({type} {base64 encoded key} {description}). - Public Key string (V({type} {base64 encoded key} {description})).
type: str type: str
key_file: key_file:
description: description:
- File with the public key. - File with the public key.
type: path type: path
requirements: requirements:
- packet-python - packet-python
"""
''' EXAMPLES = r"""
EXAMPLES = '''
# All the examples assume that you have your Packet API token in env var PACKET_API_TOKEN. # All the examples assume that you have your Packet API token in env var PACKET_API_TOKEN.
# You can also pass the api token in module param auth_token. # You can also pass the api token in module param auth_token.
@ -84,27 +82,27 @@ EXAMPLES = '''
community.general.packet_sshkey: community.general.packet_sshkey:
state: absent state: absent
id: eef49903-7a09-4ca1-af67-4087c29ab5b6 id: eef49903-7a09-4ca1-af67-4087c29ab5b6
''' """
RETURN = ''' RETURN = r"""
changed: changed:
description: True if a sshkey was created or removed. description: True if a sshkey was created or removed.
type: bool type: bool
sample: true sample: true
returned: always returned: always
sshkeys: sshkeys:
description: Information about sshkeys that were created/removed. description: Information about sshkeys that were created/removed.
type: list type: list
sample: [ sample: [
{ {
"fingerprint": "5c:93:74:7c:ed:07:17:62:28:75:79:23:d6:08:93:46", "fingerprint": "5c:93:74:7c:ed:07:17:62:28:75:79:23:d6:08:93:46",
"id": "41d61bd8-3342-428b-a09c-e67bdd18a9b7", "id": "41d61bd8-3342-428b-a09c-e67bdd18a9b7",
"key": "ssh-dss AAAAB3NzaC1kc3MAAACBAIfNT5S0ncP4BBJBYNhNPxFF9lqVhfPeu6SM1LoCocxqDc1AT3zFRi8hjIf6TLZ2AA4FYbcAWxLMhiBxZRVldT9GdBXile78kAK5z3bKTwq152DCqpxwwbaTIggLFhsU8wrfBsPWnDuAxZ0h7mmrCjoLIE3CNLDA/NmV3iB8xMThAAAAFQCStcesSgR1adPORzBxTr7hug92LwAAAIBOProm3Gk+HWedLyE8IfofLaOeRnbBRHAOL4z0SexKkVOnQ/LGN/uDIIPGGBDYTvXgKZT+jbHeulRJ2jKgfSpGKN4JxFQ8uzVH492jEiiUJtT72Ss1dCV4PmyERVIw+f54itihV3z/t25dWgowhb0int8iC/OY3cGodlmYb3wdcQAAAIBuLbB45djZXzUkOTzzcRDIRfhaxo5WipbtEM2B1fuBt2gyrvksPpH/LK6xTjdIIb0CxPu4OCxwJG0aOz5kJoRnOWIXQGhH7VowrJhsqhIc8gN9ErbO5ea8b1L76MNcAotmBDeTUiPw01IJ8MdDxfmcsCslJKgoRKSmQpCwXQtN2g== tomk@hp2", "key": "ssh-dss AAAAB3NzaC1kc3MAAACBA ... MdDxfmcsCslJKgoRKSmQpCwXQtN2g== user@server",
"label": "mynewkey33" "label": "mynewkey33"
} }
] ]
returned: always returned: always
''' # NOQA """
import os import os
import uuid import uuid

View File

@ -9,24 +9,22 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: packet_volume module: packet_volume
short_description: Create/delete a volume in Packet host short_description: Create/delete a volume in Packet host
description: description:
- Create/delete a volume in Packet host. - Create/delete a volume in Packet host.
- API is documented at U(https://www.packet.com/developers/api/#volumes). - API is documented at U(https://www.packet.com/developers/api/#volumes).
version_added: '0.2.0' version_added: '0.2.0'
author: author:
- Tomas Karasek (@t0mk) <tom.to.the.k@gmail.com> - Tomas Karasek (@t0mk) <tom.to.the.k@gmail.com>
- Nurfet Becirevic (@nurfet-becirevic) <nurfet.becirevic@gmail.com> - Nurfet Becirevic (@nurfet-becirevic) <nurfet.becirevic@gmail.com>
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
attributes: attributes:
check_mode: check_mode:
@ -55,14 +53,13 @@ options:
name: name:
description: description:
- Selector for API-generated name of the volume - Selector for API-generated name of the volume.
type: str type: str
description: description:
description: description:
- User-defined description attribute for Packet volume. - User-defined description attribute for Packet volume.
- "It is used used as idempotent identifier - if volume with given - It is used used as idempotent identifier - if volume with given description exists, new one is not created.
description exists, new one is not created."
type: str type: str
id: id:
@ -72,7 +69,7 @@ options:
plan: plan:
description: description:
- storage_1 for standard tier, storage_2 for premium (performance) tier. - V(storage_1) for standard tier, V(storage_2) for premium (performance) tier.
- Tiers are described at U(https://www.packet.com/cloud/storage/). - Tiers are described at U(https://www.packet.com/cloud/storage/).
choices: ['storage_1', 'storage_2'] choices: ['storage_1', 'storage_2']
default: 'storage_1' default: 'storage_1'
@ -91,7 +88,7 @@ options:
locked: locked:
description: description:
- Create new volume locked. - Create new volume locked.
type: bool type: bool
default: false default: false
@ -123,10 +120,9 @@ options:
requirements: requirements:
- "packet-python >= 1.35" - "packet-python >= 1.35"
"""
''' EXAMPLES = r"""
EXAMPLES = '''
# All the examples assume that you have your Packet API token in env var PACKET_API_TOKEN. # All the examples assume that you have your Packet API token in env var PACKET_API_TOKEN.
# You can also pass the api token in module param auth_token. # You can also pass the api token in module param auth_token.
@ -154,25 +150,25 @@ EXAMPLES = '''
id: "{{ result_create.id }}" id: "{{ result_create.id }}"
project_id: "{{ project_id }}" project_id: "{{ project_id }}"
state: absent state: absent
''' """
RETURN = ''' RETURN = r"""
id: id:
description: UUID of specified volume description: UUID of specified volume.
type: str type: str
returned: success returned: success
sample: 53000fb2-ee46-4673-93a8-de2c2bdba33c sample: 53000fb2-ee46-4673-93a8-de2c2bdba33c
name: name:
description: The API-generated name of the volume resource. description: The API-generated name of the volume resource.
type: str type: str
returned: if volume is attached/detached to/from some device returned: if volume is attached/detached to/from some device
sample: "volume-a91dc506" sample: "volume-a91dc506"
description: description:
description: The user-defined description of the volume resource. description: The user-defined description of the volume resource.
type: str type: str
returned: success returned: success
sample: "Just another volume" sample: "Just another volume"
''' """
import uuid import uuid

View File

@ -10,27 +10,24 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: packet_volume_attachment module: packet_volume_attachment
short_description: Attach/detach a volume to a device in the Packet host short_description: Attach/detach a volume to a device in the Packet host
description: description:
- Attach/detach a volume to a device in the Packet host. - Attach/detach a volume to a device in the Packet host.
- API is documented at U(https://www.packet.com/developers/api/volumes/). - API is documented at U(https://www.packet.com/developers/api/volumes/).
- "This module creates the attachment route in the Packet API. In order to discover - This module creates the attachment route in the Packet API. In order to discover the block devices on the server, you have to run the Attach
the block devices on the server, you have to run the Attach Scripts, Scripts, as documented at U(https://help.packet.net/technical/storage/packet-block-storage-linux).
as documented at U(https://help.packet.net/technical/storage/packet-block-storage-linux)."
version_added: '0.2.0' version_added: '0.2.0'
author: author:
- Tomas Karasek (@t0mk) <tom.to.the.k@gmail.com> - Tomas Karasek (@t0mk) <tom.to.the.k@gmail.com>
- Nurfet Becirevic (@nurfet-becirevic) <nurfet.becirevic@gmail.com> - Nurfet Becirevic (@nurfet-becirevic) <nurfet.becirevic@gmail.com>
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
attributes: attributes:
check_mode: check_mode:
@ -61,7 +58,7 @@ options:
description: description:
- Selector for the volume. - Selector for the volume.
- It can be a UUID, an API-generated volume name, or user-defined description string. - It can be a UUID, an API-generated volume name, or user-defined description string.
- 'Example values: 4a347482-b546-4f67-8300-fb5018ef0c5, volume-4a347482, "my volume"' - 'Example values: V(4a347482-b546-4f67-8300-fb5018ef0c5), V(volume-4a347482), V(my volume).'
type: str type: str
required: true required: true
@ -69,15 +66,14 @@ options:
description: description:
- Selector for the device. - Selector for the device.
- It can be a UUID of the device, or a hostname. - It can be a UUID of the device, or a hostname.
- 'Example values: 98a14f7a-3d27-4478-b7cf-35b5670523f3, "my device"' - 'Example values: 98a14f7a-3d27-4478-b7cf-35b5670523f3, "my device".'
type: str type: str
requirements: requirements:
- "packet-python >= 1.35" - "packet-python >= 1.35"
"""
''' EXAMPLES = r"""
EXAMPLES = '''
# All the examples assume that you have your Packet API token in env var PACKET_API_TOKEN. # All the examples assume that you have your Packet API token in env var PACKET_API_TOKEN.
# You can also pass the api token in module param auth_token. # You can also pass the api token in module param auth_token.
@ -122,19 +118,19 @@ EXAMPLES = '''
volume: "{{ volname }}" volume: "{{ volname }}"
device: "{{ devname }}" device: "{{ devname }}"
state: absent state: absent
''' """
RETURN = ''' RETURN = r"""
volume_id: volume_id:
description: UUID of volume addressed by the module call. description: UUID of volume addressed by the module call.
type: str type: str
returned: success returned: success
device_id: device_id:
description: UUID of device addressed by the module call. description: UUID of device addressed by the module call.
type: str type: str
returned: success returned: success
''' """
import uuid import uuid

View File

@ -12,172 +12,161 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = """ DOCUMENTATION = r"""
---
module: pacman module: pacman
short_description: Manage packages with I(pacman) short_description: Manage packages with I(pacman)
description: description:
- Manage packages with the I(pacman) package manager, which is used by Arch Linux and its variants. - Manage packages with the I(pacman) package manager, which is used by Arch Linux and its variants.
author: author:
- Indrajit Raychaudhuri (@indrajitr) - Indrajit Raychaudhuri (@indrajitr)
- Aaron Bull Schaefer (@elasticdog) <aaron@elasticdog.com> - Aaron Bull Schaefer (@elasticdog) <aaron@elasticdog.com>
- Maxime de Roucy (@tchernomax) - Maxime de Roucy (@tchernomax)
- Jean Raby (@jraby) - Jean Raby (@jraby)
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
attributes: attributes:
check_mode: check_mode:
support: full support: full
diff_mode: diff_mode:
support: full support: full
options: options:
name: name:
description:
- Name or list of names of the package(s) or file(s) to install, upgrade, or remove.
Cannot be used in combination with O(upgrade).
aliases: [ package, pkg ]
type: list
elements: str
state:
description:
- Whether to install (V(present) or V(installed), V(latest)), or remove (V(absent) or V(removed)) a package.
- V(present) and V(installed) will simply ensure that a desired package is installed.
- V(latest) will update the specified package if it is not of the latest available version.
- V(absent) and V(removed) will remove the specified package.
default: present
choices: [ absent, installed, latest, present, removed ]
type: str
force:
description:
- When removing packages, forcefully remove them, without any checks.
Same as O(extra_args="--nodeps --nodeps").
- When combined with O(update_cache), force a refresh of all package databases.
Same as O(update_cache_extra_args="--refresh --refresh").
default: false
type: bool
remove_nosave:
description:
- When removing packages, do not save modified configuration files as C(.pacsave) files.
(passes C(--nosave) to pacman)
version_added: 4.6.0
default: false
type: bool
executable:
description:
- Path of the binary to use. This can either be C(pacman) or a pacman compatible AUR helper.
- Pacman compatibility is unfortunately ill defined, in particular, this modules makes
extensive use of the C(--print-format) directive which is known not to be implemented by
some AUR helpers (notably, C(yay)).
- Beware that AUR helpers might behave unexpectedly and are therefore not recommended.
default: pacman
type: str
version_added: 3.1.0
extra_args:
description:
- Additional option to pass to pacman when enforcing O(state).
default: ''
type: str
update_cache:
description:
- Whether or not to refresh the master package lists.
- This can be run as part of a package installation or as a separate step.
- If not specified, it defaults to V(false).
- Please note that this option only had an influence on the module's C(changed) state
if O(name) and O(upgrade) are not specified before community.general 5.0.0.
See the examples for how to keep the old behavior.
type: bool
update_cache_extra_args:
description:
- Additional option to pass to pacman when enforcing O(update_cache).
default: ''
type: str
upgrade:
description:
- Whether or not to upgrade the whole system.
Cannot be used in combination with O(name).
- If not specified, it defaults to V(false).
type: bool
upgrade_extra_args:
description:
- Additional option to pass to pacman when enforcing O(upgrade).
default: ''
type: str
reason:
description:
- The install reason to set for the packages.
choices: [ dependency, explicit ]
type: str
version_added: 5.4.0
reason_for:
description:
- Set the install reason for V(all) packages or only for V(new) packages.
- In case of O(state=latest) already installed packages which will be updated to a newer version are not counted as V(new).
default: new
choices: [ all, new ]
type: str
version_added: 5.4.0
notes:
- When used with a C(loop:) each package will be processed individually,
it is much more efficient to pass the list directly to the O(name) option.
- To use an AUR helper (O(executable) option), a few extra setup steps might be required beforehand.
For example, a dedicated build user with permissions to install packages could be necessary.
- >
In the tests, while using C(yay) as the O(executable) option, the module failed to install AUR packages
with the error: C(error: target not found: <pkg>).
"""
RETURN = """
packages:
description: description:
- A list of packages that have been changed. - Name or list of names of the package(s) or file(s) to install, upgrade, or remove. Cannot be used in combination with O(upgrade).
- Before community.general 4.5.0 this was only returned when O(upgrade=true). aliases: [package, pkg]
In community.general 4.5.0, it was sometimes omitted when the package list is empty,
but since community.general 4.6.0 it is always returned when O(name) is specified or
O(upgrade=true).
returned: success and O(name) is specified or O(upgrade=true)
type: list type: list
elements: str elements: str
sample: [ package, other-package ]
cache_updated: state:
description: description:
- The changed status of C(pacman -Sy). - Whether to install (V(present) or V(installed), V(latest)), or remove (V(absent) or V(removed)) a package.
- Useful when O(name) or O(upgrade=true) are specified next to O(update_cache=true). - V(present) and V(installed) will simply ensure that a desired package is installed.
returned: success, when O(update_cache=true) - V(latest) will update the specified package if it is not of the latest available version.
- V(absent) and V(removed) will remove the specified package.
default: present
choices: [absent, installed, latest, present, removed]
type: str
force:
description:
- When removing packages, forcefully remove them, without any checks. Same as O(extra_args="--nodeps --nodeps").
- When combined with O(update_cache), force a refresh of all package databases. Same as O(update_cache_extra_args="--refresh --refresh").
default: false
type: bool type: bool
sample: false
remove_nosave:
description:
- When removing packages, do not save modified configuration files as C(.pacsave) files. (passes C(--nosave) to pacman).
version_added: 4.6.0 version_added: 4.6.0
default: false
type: bool
stdout: executable:
description: description:
- Output from pacman. - Path of the binary to use. This can either be C(pacman) or a pacman compatible AUR helper.
returned: success, when needed - Pacman compatibility is unfortunately ill defined, in particular, this modules makes extensive use of the C(--print-format) directive
which is known not to be implemented by some AUR helpers (notably, C(yay)).
- Beware that AUR helpers might behave unexpectedly and are therefore not recommended.
default: pacman
type: str type: str
sample: ":: Synchronizing package databases... core is up to date :: Starting full system upgrade..." version_added: 3.1.0
version_added: 4.1.0
stderr: extra_args:
description: description:
- Error output from pacman. - Additional option to pass to pacman when enforcing O(state).
returned: success, when needed default: ''
type: str type: str
sample: "warning: libtool: local (2.4.6+44+gb9b44533-14) is newer than core (2.4.6+42+gb88cebd5-15)\nwarning ..."
version_added: 4.1.0 update_cache:
description:
- Whether or not to refresh the master package lists.
- This can be run as part of a package installation or as a separate step.
- If not specified, it defaults to V(false).
- Please note that this option only had an influence on the module's C(changed) state if O(name) and O(upgrade) are not specified before
community.general 5.0.0. See the examples for how to keep the old behavior.
type: bool
update_cache_extra_args:
description:
- Additional option to pass to pacman when enforcing O(update_cache).
default: ''
type: str
upgrade:
description:
- Whether or not to upgrade the whole system. Cannot be used in combination with O(name).
- If not specified, it defaults to V(false).
type: bool
upgrade_extra_args:
description:
- Additional option to pass to pacman when enforcing O(upgrade).
default: ''
type: str
reason:
description:
- The install reason to set for the packages.
choices: [dependency, explicit]
type: str
version_added: 5.4.0
reason_for:
description:
- Set the install reason for V(all) packages or only for V(new) packages.
- In case of O(state=latest) already installed packages which will be updated to a newer version are not counted as V(new).
default: new
choices: [all, new]
type: str
version_added: 5.4.0
notes:
- When used with a C(loop:) each package will be processed individually, it is much more efficient to pass the list directly to the O(name)
option.
- To use an AUR helper (O(executable) option), a few extra setup steps might be required beforehand. For example, a dedicated build user with
permissions to install packages could be necessary.
- 'In the tests, while using C(yay) as the O(executable) option, the module failed to install AUR packages with the error: C(error: target not
found: <pkg>).'
""" """
EXAMPLES = """ RETURN = r"""
packages:
description:
- A list of packages that have been changed.
- Before community.general 4.5.0 this was only returned when O(upgrade=true). In community.general 4.5.0, it was sometimes omitted when the
package list is empty, but since community.general 4.6.0 it is always returned when O(name) is specified or O(upgrade=true).
returned: success and O(name) is specified or O(upgrade=true)
type: list
elements: str
sample: [package, other-package]
cache_updated:
description:
- The changed status of C(pacman -Sy).
- Useful when O(name) or O(upgrade=true) are specified next to O(update_cache=true).
returned: success, when O(update_cache=true)
type: bool
sample: false
version_added: 4.6.0
stdout:
description:
- Output from pacman.
returned: success, when needed
type: str
sample: ":: Synchronizing package databases... core is up to date :: Starting full system upgrade..."
version_added: 4.1.0
stderr:
description:
- Error output from pacman.
returned: success, when needed
type: str
sample: "warning: libtool: local (2.4.6+44+gb9b44533-14) is newer than core (2.4.6+42+gb88cebd5-15)\nwarning ..."
version_added: 4.1.0
"""
EXAMPLES = r"""
- name: Install package foo from repo - name: Install package foo from repo
community.general.pacman: community.general.pacman:
name: foo name: foo

View File

@ -8,84 +8,83 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: pacman_key module: pacman_key
author: author:
- George Rawlinson (@grawlinson) - George Rawlinson (@grawlinson)
version_added: "3.2.0" version_added: "3.2.0"
short_description: Manage pacman's list of trusted keys short_description: Manage pacman's list of trusted keys
description: description:
- Add or remove gpg keys from the pacman keyring. - Add or remove gpg keys from the pacman keyring.
notes: notes:
- Use full-length key ID (40 characters). - Use full-length key ID (40 characters).
- Keys will be verified when using O(data), O(file), or O(url) unless O(verify) is overridden. - Keys will be verified when using O(data), O(file), or O(url) unless O(verify) is overridden.
- Keys will be locally signed after being imported into the keyring. - Keys will be locally signed after being imported into the keyring.
- If the key ID exists in the keyring, the key will not be added unless O(force_update) is specified. - If the key ID exists in the keyring, the key will not be added unless O(force_update) is specified.
- O(data), O(file), O(url), and O(keyserver) are mutually exclusive. - O(data), O(file), O(url), and O(keyserver) are mutually exclusive.
requirements: requirements:
- gpg - gpg
- pacman-key - pacman-key
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
attributes: attributes:
check_mode: check_mode:
support: full support: full
diff_mode: diff_mode:
support: none support: none
options: options:
id: id:
description: description:
- The 40 character identifier of the key. - The 40 character identifier of the key.
- Including this allows check mode to correctly report the changed state. - Including this allows check mode to correctly report the changed state.
- Do not specify a subkey ID, instead specify the primary key ID. - Do not specify a subkey ID, instead specify the primary key ID.
required: true required: true
type: str type: str
data: data:
description: description:
- The keyfile contents to add to the keyring. - The keyfile contents to add to the keyring.
- Must be of C(PGP PUBLIC KEY BLOCK) type. - Must be of C(PGP PUBLIC KEY BLOCK) type.
type: str type: str
file: file:
description: description:
- The path to a keyfile on the remote server to add to the keyring. - The path to a keyfile on the remote server to add to the keyring.
- Remote file must be of C(PGP PUBLIC KEY BLOCK) type. - Remote file must be of C(PGP PUBLIC KEY BLOCK) type.
type: path type: path
url: url:
description: description:
- The URL to retrieve keyfile from. - The URL to retrieve keyfile from.
- Remote file must be of C(PGP PUBLIC KEY BLOCK) type. - Remote file must be of C(PGP PUBLIC KEY BLOCK) type.
type: str type: str
keyserver: keyserver:
description: description:
- The keyserver used to retrieve key from. - The keyserver used to retrieve key from.
type: str type: str
verify: verify:
description: description:
- Whether or not to verify the keyfile's key ID against specified key ID. - Whether or not to verify the keyfile's key ID against specified key ID.
type: bool type: bool
default: true default: true
force_update: force_update:
description: description:
- This forces the key to be updated if it already exists in the keyring. - This forces the key to be updated if it already exists in the keyring.
type: bool type: bool
default: false default: false
keyring: keyring:
description: description:
- The full path to the keyring folder on the remote server. - The full path to the keyring folder on the remote server.
- If not specified, module will use pacman's default (V(/etc/pacman.d/gnupg)). - If not specified, module will use pacman's default (V(/etc/pacman.d/gnupg)).
- Useful if the remote system requires an alternative gnupg directory. - Useful if the remote system requires an alternative gnupg directory.
type: path type: path
default: /etc/pacman.d/gnupg default: /etc/pacman.d/gnupg
state: state:
description: description:
- Ensures that the key is present (added) or absent (revoked). - Ensures that the key is present (added) or absent (revoked).
default: present default: present
choices: [ absent, present ] choices: [absent, present]
type: str type: str
''' """
EXAMPLES = ''' EXAMPLES = r"""
- name: Import a key via local file - name: Import a key via local file
community.general.pacman_key: community.general.pacman_key:
id: 01234567890ABCDE01234567890ABCDE12345678 id: 01234567890ABCDE01234567890ABCDE12345678
@ -119,9 +118,9 @@ EXAMPLES = '''
community.general.pacman_key: community.general.pacman_key:
id: 01234567890ABCDE01234567890ABCDE12345678 id: 01234567890ABCDE01234567890ABCDE12345678
state: absent state: absent
''' """
RETURN = r''' # ''' RETURN = r""" # """
import os.path import os.path
import tempfile import tempfile

View File

@ -9,84 +9,82 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
module: pagerduty module: pagerduty
short_description: Create PagerDuty maintenance windows short_description: Create PagerDuty maintenance windows
description: description:
- This module will let you create PagerDuty maintenance windows - This module will let you create PagerDuty maintenance windows.
author: author:
- "Andrew Newdigate (@suprememoocow)" - "Andrew Newdigate (@suprememoocow)"
- "Dylan Silva (@thaumos)" - "Dylan Silva (@thaumos)"
- "Justin Johns (!UNKNOWN)" - "Justin Johns (!UNKNOWN)"
- "Bruce Pennypacker (@bpennypacker)" - "Bruce Pennypacker (@bpennypacker)"
requirements: requirements:
- PagerDuty API access - PagerDuty API access
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
attributes: attributes:
check_mode: check_mode:
support: none support: none
diff_mode: diff_mode:
support: none support: none
options: options:
state: state:
type: str type: str
description: description:
- Create a maintenance window or get a list of ongoing windows. - Create a maintenance window or get a list of ongoing windows.
required: true required: true
choices: [ "running", "started", "ongoing", "absent" ] choices: ["running", "started", "ongoing", "absent"]
name: name:
type: str type: str
description: description:
- PagerDuty unique subdomain. Obsolete. It is not used with PagerDuty REST v2 API. - PagerDuty unique subdomain. Obsolete. It is not used with PagerDuty REST v2 API.
user: user:
type: str type: str
description: description:
- PagerDuty user ID. Obsolete. Please, use O(token) for authorization. - PagerDuty user ID. Obsolete. Please, use O(token) for authorization.
token: token:
type: str type: str
description: description:
- A pagerduty token, generated on the pagerduty site. It is used for authorization. - A pagerduty token, generated on the pagerduty site. It is used for authorization.
required: true required: true
requester_id: requester_id:
type: str type: str
description: description:
- ID of user making the request. Only needed when creating a maintenance_window. - ID of user making the request. Only needed when creating a maintenance_window.
service: service:
type: list type: list
elements: str elements: str
description: description:
- A comma separated list of PagerDuty service IDs. - A comma separated list of PagerDuty service IDs.
aliases: [ services ] aliases: [services]
window_id: window_id:
type: str type: str
description: description:
- ID of maintenance window. Only needed when absent a maintenance_window. - ID of maintenance window. Only needed when absent a maintenance_window.
hours: hours:
type: str type: str
description: description:
- Length of maintenance window in hours. - Length of maintenance window in hours.
default: '1' default: '1'
minutes: minutes:
type: str type: str
description: description:
- Maintenance window in minutes (this is added to the hours). - Maintenance window in minutes (this is added to the hours).
default: '0' default: '0'
desc: desc:
type: str type: str
description: description:
- Short description of maintenance window. - Short description of maintenance window.
default: Created by Ansible default: Created by Ansible
validate_certs: validate_certs:
description: description:
- If V(false), SSL certificates will not be validated. This should only be used - If V(false), SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.
on personally controlled sites using self-signed certificates. type: bool
type: bool default: true
default: true """
'''
EXAMPLES = ''' EXAMPLES = r"""
- name: List ongoing maintenance windows using a token - name: List ongoing maintenance windows using a token
community.general.pagerduty: community.general.pagerduty:
name: companyabc name: companyabc
@ -143,7 +141,7 @@ EXAMPLES = '''
token: yourtoken token: yourtoken
state: absent state: absent
window_id: "{{ pd_window.result.maintenance_windows[0].id }}" window_id: "{{ pd_window.result.maintenance_windows[0].id }}"
''' """
import datetime import datetime
import json import json

View File

@ -8,150 +8,149 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
module: pagerduty_alert module: pagerduty_alert
short_description: Trigger, acknowledge or resolve PagerDuty incidents short_description: Trigger, acknowledge or resolve PagerDuty incidents
description: description:
- This module will let you trigger, acknowledge or resolve a PagerDuty incident by sending events - This module will let you trigger, acknowledge or resolve a PagerDuty incident by sending events.
author: author:
- "Amanpreet Singh (@ApsOps)" - "Amanpreet Singh (@ApsOps)"
- "Xiao Shen (@xshen1)" - "Xiao Shen (@xshen1)"
requirements: requirements:
- PagerDuty API access - PagerDuty API access
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
attributes: attributes:
check_mode: check_mode:
support: full support: full
diff_mode: diff_mode:
support: none support: none
options: options:
name: name:
type: str type: str
description: description:
- PagerDuty unique subdomain. Obsolete. It is not used with PagerDuty REST v2 API. - PagerDuty unique subdomain. Obsolete. It is not used with PagerDuty REST v2 API.
api_key: api_key:
type: str type: str
description: description:
- The pagerduty API key (readonly access), generated on the pagerduty site. - The pagerduty API key (readonly access), generated on the pagerduty site.
- Required if O(api_version=v1). - Required if O(api_version=v1).
integration_key: integration_key:
type: str type: str
description: description:
- The GUID of one of your 'Generic API' services. - The GUID of one of your 'Generic API' services.
- This is the 'integration key' listed on a 'Integrations' tab of PagerDuty service. - This is the 'integration key' listed on a 'Integrations' tab of PagerDuty service.
service_id: service_id:
type: str type: str
description: description:
- ID of PagerDuty service when incidents will be triggered, acknowledged or resolved. - ID of PagerDuty service when incidents will be triggered, acknowledged or resolved.
- Required if O(api_version=v1). - Required if O(api_version=v1).
service_key: service_key:
type: str type: str
description: description:
- The GUID of one of your 'Generic API' services. Obsolete. Please use O(integration_key). - The GUID of one of your 'Generic API' services. Obsolete. Please use O(integration_key).
state: state:
type: str type: str
description: description:
- Type of event to be sent. - Type of event to be sent.
required: true required: true
choices: choices:
- 'triggered' - 'triggered'
- 'acknowledged' - 'acknowledged'
- 'resolved' - 'resolved'
api_version: api_version:
type: str type: str
description: description:
- The API version we want to use to run the module. - The API version we want to use to run the module.
- V1 is more limited with option we can provide to trigger incident. - V1 is more limited with option we can provide to trigger incident.
- V2 has more variables for example, O(severity), O(source), O(custom_details), etc. - V2 has more variables for example, O(severity), O(source), O(custom_details) and so on.
default: 'v1' default: 'v1'
choices: choices:
- 'v1' - 'v1'
- 'v2' - 'v2'
version_added: 7.4.0 version_added: 7.4.0
client: client:
type: str type: str
description: description:
- The name of the monitoring client that is triggering this event. - The name of the monitoring client that is triggering this event.
required: false required: false
client_url: client_url:
type: str type: str
description: description:
- The URL of the monitoring client that is triggering this event. - The URL of the monitoring client that is triggering this event.
required: false required: false
component: component:
type: str type: str
description: description:
- Component of the source machine that is responsible for the event, for example C(mysql) or C(eth0). - Component of the source machine that is responsible for the event, for example C(mysql) or C(eth0).
required: false required: false
version_added: 7.4.0 version_added: 7.4.0
custom_details: custom_details:
type: dict type: dict
description: description:
- Additional details about the event and affected system. - Additional details about the event and affected system.
- A dictionary with custom keys and values. - A dictionary with custom keys and values.
required: false required: false
version_added: 7.4.0 version_added: 7.4.0
desc: desc:
type: str type: str
description: description:
- For O(state=triggered) - Required. Short description of the problem that led to this trigger. This field (or a truncated version) - For O(state=triggered) - Required. Short description of the problem that led to this trigger. This field (or a truncated version) will
will be used when generating phone calls, SMS messages and alert emails. It will also appear on the incidents tables in the PagerDuty UI. be used when generating phone calls, SMS messages and alert emails. It will also appear on the incidents tables in the PagerDuty UI. The
The maximum length is 1024 characters. maximum length is 1024 characters.
- For O(state=acknowledged) or O(state=resolved) - Text that will appear in the incident's log associated with this event. - For O(state=acknowledged) or O(state=resolved) - Text that will appear in the incident's log associated with this event.
required: false required: false
default: Created via Ansible default: Created via Ansible
incident_class: incident_class:
type: str type: str
description: description:
- The class/type of the event, for example C(ping failure) or C(cpu load). - The class/type of the event, for example C(ping failure) or C(cpu load).
required: false required: false
version_added: 7.4.0 version_added: 7.4.0
incident_key: incident_key:
type: str type: str
description: description:
- Identifies the incident to which this O(state) should be applied. - Identifies the incident to which this O(state) should be applied.
- For O(state=triggered) - If there's no open (i.e. unresolved) incident with this key, a new one will be created. If there's already an - For O(state=triggered) - If there is no open (in other words unresolved) incident with this key, a new one will be created. If there is already an
open incident with a matching key, this event will be appended to that incident's log. The event key provides an easy way to 'de-dup' open incident with a matching key, this event will be appended to that incident's log. The event key provides an easy way to 'de-dup'
problem reports. If no O(incident_key) is provided, then it will be generated by PagerDuty. problem reports. If no O(incident_key) is provided, then it will be generated by PagerDuty.
- For O(state=acknowledged) or O(state=resolved) - This should be the incident_key you received back when the incident was first opened by a - For O(state=acknowledged) or O(state=resolved) - This should be the incident_key you received back when the incident was first opened
trigger event. Acknowledge events referencing resolved or nonexistent incidents will be discarded. by a trigger event. Acknowledge events referencing resolved or nonexistent incidents will be discarded.
required: false required: false
link_url: link_url:
type: str type: str
description: description:
- Relevant link url to the alert. For example, the website or the job link. - Relevant link URL to the alert. For example, the website or the job link.
required: false required: false
version_added: 7.4.0 version_added: 7.4.0
link_text: link_text:
type: str type: str
description: description:
- A short description of the link_url. - A short description of the O(link_url).
required: false required: false
version_added: 7.4.0 version_added: 7.4.0
source: source:
type: str type: str
description: description:
- The unique location of the affected system, preferably a hostname or FQDN. - The unique location of the affected system, preferably a hostname or FQDN.
- Required in case of O(state=trigger) and O(api_version=v2). - Required in case of O(state=trigger) and O(api_version=v2).
required: false required: false
version_added: 7.4.0 version_added: 7.4.0
severity: severity:
type: str type: str
description: description:
- The perceived severity of the status the event is describing with respect to the affected system. - The perceived severity of the status the event is describing with respect to the affected system.
- Required in case of O(state=trigger) and O(api_version=v2). - Required in case of O(state=trigger) and O(api_version=v2).
default: 'critical' default: 'critical'
choices: choices:
- 'critical' - 'critical'
- 'warning' - 'warning'
- 'error' - 'error'
- 'info' - 'info'
version_added: 7.4.0 version_added: 7.4.0
''' """
EXAMPLES = ''' EXAMPLES = r"""
- name: Trigger an incident with just the basic options - name: Trigger an incident with just the basic options
community.general.pagerduty_alert: community.general.pagerduty_alert:
name: companyabc name: companyabc
@ -226,7 +225,7 @@ EXAMPLES = '''
integration_key: xxx integration_key: xxx
incident_key: somekey incident_key: somekey
state: resolved state: resolved
''' """
import json import json
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule

View File

@ -8,7 +8,7 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
module: pagerduty_change module: pagerduty_change
short_description: Track a code or infrastructure change as a PagerDuty change event short_description: Track a code or infrastructure change as a PagerDuty change event
version_added: 1.3.0 version_added: 1.3.0
@ -31,8 +31,7 @@ attributes:
options: options:
integration_key: integration_key:
description: description:
- The integration key that identifies the service the change was made to. - The integration key that identifies the service the change was made to. This can be found by adding an integration to a service in PagerDuty.
This can be found by adding an integration to a service in PagerDuty.
required: true required: true
type: str type: str
summary: summary:
@ -82,14 +81,14 @@ options:
type: str type: str
validate_certs: validate_certs:
description: description:
- If V(false), SSL certificates for the target URL will not be validated. - If V(false), SSL certificates for the target URL will not be validated. This should only be used on personally controlled sites using
This should only be used on personally controlled sites using self-signed certificates. self-signed certificates.
required: false required: false
default: true default: true
type: bool type: bool
''' """
EXAMPLES = ''' EXAMPLES = r"""
- name: Track the deployment as a PagerDuty change event - name: Track the deployment as a PagerDuty change event
community.general.pagerduty_change: community.general.pagerduty_change:
integration_key: abc123abc123abc123abc123abc123ab integration_key: abc123abc123abc123abc123abc123ab
@ -106,7 +105,7 @@ EXAMPLES = '''
environment: production environment: production
link_url: https://github.com/ansible-collections/community.general/pull/1269 link_url: https://github.com/ansible-collections/community.general/pull/1269
link_text: View changes on GitHub link_text: View changes on GitHub
''' """
from ansible.module_utils.urls import fetch_url from ansible.module_utils.urls import fetch_url
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule

View File

@ -8,64 +8,63 @@
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = r''' DOCUMENTATION = r"""
---
module: pagerduty_user module: pagerduty_user
short_description: Manage a user account on PagerDuty short_description: Manage a user account on PagerDuty
description: description:
- This module manages the creation/removal of a user account on PagerDuty. - This module manages the creation/removal of a user account on PagerDuty.
version_added: '1.3.0' version_added: '1.3.0'
author: Zainab Alsaffar (@zanssa) author: Zainab Alsaffar (@zanssa)
requirements: requirements:
- pdpyras python module = 4.1.1 - pdpyras python module = 4.1.1
- PagerDuty API Access - PagerDuty API Access
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
attributes: attributes:
check_mode: check_mode:
support: full support: full
diff_mode: diff_mode:
support: none support: none
options: options:
access_token: access_token:
description: description:
- An API access token to authenticate with the PagerDuty REST API. - An API access token to authenticate with the PagerDuty REST API.
required: true required: true
type: str type: str
pd_user: pd_user:
description: description:
- Name of the user in PagerDuty. - Name of the user in PagerDuty.
required: true required: true
type: str type: str
pd_email: pd_email:
description: description:
- The user's email address. - The user's email address.
- O(pd_email) is the unique identifier used and cannot be updated using this module. - O(pd_email) is the unique identifier used and cannot be updated using this module.
required: true required: true
type: str type: str
pd_role: pd_role:
description: description:
- The user's role. - The user's role.
choices: ['global_admin', 'manager', 'responder', 'observer', 'stakeholder', 'limited_stakeholder', 'restricted_access'] choices: ['global_admin', 'manager', 'responder', 'observer', 'stakeholder', 'limited_stakeholder', 'restricted_access']
default: 'responder' default: 'responder'
type: str type: str
state: state:
description: description:
- State of the user. - State of the user.
- On V(present), it creates a user if the user doesn't exist. - On V(present), it creates a user if the user does not exist.
- On V(absent), it removes a user if the account exists. - On V(absent), it removes a user if the account exists.
choices: ['present', 'absent'] choices: ['present', 'absent']
default: 'present' default: 'present'
type: str type: str
pd_teams: pd_teams:
description: description:
- The teams to which the user belongs. - The teams to which the user belongs.
- Required if O(state=present). - Required if O(state=present).
type: list type: list
elements: str elements: str
''' """
EXAMPLES = r''' EXAMPLES = r"""
- name: Create a user account on PagerDuty - name: Create a user account on PagerDuty
community.general.pagerduty_user: community.general.pagerduty_user:
access_token: 'Your_Access_token' access_token: 'Your_Access_token'
@ -81,9 +80,9 @@ EXAMPLES = r'''
pd_user: user_full_name pd_user: user_full_name
pd_email: user_email pd_email: user_email
state: "absent" state: "absent"
''' """
RETURN = r''' # ''' RETURN = r""" # """
from os import path from os import path
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule

View File

@ -8,11 +8,10 @@
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = r''' DOCUMENTATION = r"""
---
module: pam_limits module: pam_limits
author: author:
- "Sebastien Rohaut (@usawa)" - "Sebastien Rohaut (@usawa)"
short_description: Modify Linux PAM limits short_description: Modify Linux PAM limits
description: description:
- The M(community.general.pam_limits) module modifies PAM limits. - The M(community.general.pam_limits) module modifies PAM limits.
@ -38,32 +37,32 @@ options:
description: description:
- Limit type, see C(man 5 limits.conf) for an explanation. - Limit type, see C(man 5 limits.conf) for an explanation.
required: true required: true
choices: [ "hard", "soft", "-" ] choices: ["hard", "soft", "-"]
limit_item: limit_item:
type: str type: str
description: description:
- The limit to be set. - The limit to be set.
required: true required: true
choices: choices:
- "core" - "core"
- "data" - "data"
- "fsize" - "fsize"
- "memlock" - "memlock"
- "nofile" - "nofile"
- "rss" - "rss"
- "stack" - "stack"
- "cpu" - "cpu"
- "nproc" - "nproc"
- "as" - "as"
- "maxlogins" - "maxlogins"
- "maxsyslogins" - "maxsyslogins"
- "priority" - "priority"
- "locks" - "locks"
- "sigpending" - "sigpending"
- "msgqueue" - "msgqueue"
- "nice" - "nice"
- "rtprio" - "rtprio"
- "chroot" - "chroot"
value: value:
type: str type: str
description: description:
@ -74,24 +73,21 @@ options:
required: true required: true
backup: backup:
description: description:
- Create a backup file including the timestamp information so you can get - Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly.
the original file back if you somehow clobbered it incorrectly.
required: false required: false
type: bool type: bool
default: false default: false
use_min: use_min:
description: description:
- If set to V(true), the minimal value will be used or conserved. - If set to V(true), the minimal value will be used or conserved.
- If the specified value is inferior to the value in the file, - If the specified value is inferior to the value in the file, file content is replaced with the new value, else content is not modified.
file content is replaced with the new value, else content is not modified.
required: false required: false
type: bool type: bool
default: false default: false
use_max: use_max:
description: description:
- If set to V(true), the maximal value will be used or conserved. - If set to V(true), the maximal value will be used or conserved.
- If the specified value is superior to the value in the file, - If the specified value is superior to the value in the file, file content is replaced with the new value, else content is not modified.
file content is replaced with the new value, else content is not modified.
required: false required: false
type: bool type: bool
default: false default: false
@ -109,9 +105,9 @@ options:
default: '' default: ''
notes: notes:
- If O(dest) file does not exist, it is created. - If O(dest) file does not exist, it is created.
''' """
EXAMPLES = r''' EXAMPLES = r"""
- name: Add or modify nofile soft limit for the user joe - name: Add or modify nofile soft limit for the user joe
community.general.pam_limits: community.general.pam_limits:
domain: joe domain: joe
@ -141,7 +137,7 @@ EXAMPLES = r'''
limit_type: hard limit_type: hard
limit_item: nofile limit_item: nofile
value: 39693561 value: 39693561
''' """
import os import os
import re import re

View File

@ -9,15 +9,14 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = r''' DOCUMENTATION = r"""
module: pamd module: pamd
author: author:
- Kenneth D. Evensen (@kevensen) - Kenneth D. Evensen (@kevensen)
short_description: Manage PAM Modules short_description: Manage PAM Modules
description: description:
- Edit PAM service's type, control, module path and module arguments. - Edit PAM service's type, control, module path and module arguments.
- In order for a PAM rule to be modified, the type, control and - In order for a PAM rule to be modified, the type, control and module_path must match an existing rule. See man(5) pam.d for details.
module_path must match an existing rule. See man(5) pam.d for details.
notes: notes:
- This module does not handle authselect profiles. - This module does not handle authselect profiles.
extends_documentation_fragment: extends_documentation_fragment:
@ -30,8 +29,7 @@ attributes:
options: options:
name: name:
description: description:
- The name generally refers to the PAM service file to - The name generally refers to the PAM service file to change, for example system-auth.
change, for example system-auth.
type: str type: str
required: true required: true
type: type:
@ -40,12 +38,11 @@ options:
- The O(type), O(control), and O(module_path) options all must match a rule to be modified. - The O(type), O(control), and O(module_path) options all must match a rule to be modified.
type: str type: str
required: true required: true
choices: [ account, -account, auth, -auth, password, -password, session, -session ] choices: [account, -account, auth, -auth, password, -password, session, -session]
control: control:
description: description:
- The control of the PAM rule being modified. - The control of the PAM rule being modified.
- This may be a complicated control with brackets. If this is the case, be - This may be a complicated control with brackets. If this is the case, be sure to put "[bracketed controls]" in quotes.
sure to put "[bracketed controls]" in quotes.
- The O(type), O(control), and O(module_path) options all must match a rule to be modified. - The O(type), O(control), and O(module_path) options all must match a rule to be modified.
type: str type: str
required: true required: true
@ -57,55 +54,49 @@ options:
required: true required: true
new_type: new_type:
description: description:
- The new type to assign to the new rule. - The new type to assign to the new rule.
type: str type: str
choices: [ account, -account, auth, -auth, password, -password, session, -session ] choices: [account, -account, auth, -auth, password, -password, session, -session]
new_control: new_control:
description: description:
- The new control to assign to the new rule. - The new control to assign to the new rule.
type: str type: str
new_module_path: new_module_path:
description: description:
- The new module path to be assigned to the new rule. - The new module path to be assigned to the new rule.
type: str type: str
module_arguments: module_arguments:
description: description:
- When O(state=updated), the O(module_arguments) will replace existing module_arguments. - When O(state=updated), the O(module_arguments) will replace existing module_arguments.
- When O(state=args_absent) args matching those listed in O(module_arguments) will be removed. - When O(state=args_absent) args matching those listed in O(module_arguments) will be removed.
- When O(state=args_present) any args listed in O(module_arguments) are added if - When O(state=args_present) any args listed in O(module_arguments) are added if missing from the existing rule.
missing from the existing rule. - Furthermore, if the module argument takes a value denoted by C(=), the value will be changed to that specified in module_arguments.
- Furthermore, if the module argument takes a value denoted by C(=),
the value will be changed to that specified in module_arguments.
type: list type: list
elements: str elements: str
state: state:
description: description:
- The default of V(updated) will modify an existing rule if type, - The default of V(updated) will modify an existing rule if type, control and module_path all match an existing rule.
control and module_path all match an existing rule. - With V(before), the new rule will be inserted before a rule matching type, control and module_path.
- With V(before), the new rule will be inserted before a rule matching type, - Similarly, with V(after), the new rule will be inserted after an existing rulematching type, control and module_path.
control and module_path. - With either V(before) or V(after) O(new_type), O(new_control), and O(new_module_path) must all be specified.
- Similarly, with V(after), the new rule will be inserted after an existing rulematching type, - If state is V(args_absent) or V(args_present), O(new_type), O(new_control), and O(new_module_path) will be ignored.
control and module_path. - State V(absent) will remove the rule.
- With either V(before) or V(after) O(new_type), O(new_control), and O(new_module_path) must all be specified.
- If state is V(args_absent) or V(args_present), O(new_type), O(new_control), and O(new_module_path) will be ignored.
- State V(absent) will remove the rule.
type: str type: str
choices: [ absent, before, after, args_absent, args_present, updated ] choices: [absent, before, after, args_absent, args_present, updated]
default: updated default: updated
path: path:
description: description:
- This is the path to the PAM service files. - This is the path to the PAM service files.
type: path type: path
default: /etc/pam.d default: /etc/pam.d
backup: backup:
description: description:
- Create a backup file including the timestamp information so you can - Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly.
get the original file back if you somehow clobbered it incorrectly. type: bool
type: bool default: false
default: false """
'''
EXAMPLES = r''' EXAMPLES = r"""
- name: Update pamd rule's control in /etc/pam.d/system-auth - name: Update pamd rule's control in /etc/pam.d/system-auth
community.general.pamd: community.general.pamd:
name: system-auth name: system-auth
@ -133,8 +124,7 @@ EXAMPLES = r'''
new_module_path: pam_faillock.so new_module_path: pam_faillock.so
state: before state: before
- name: Insert a new rule pam_wheel.so with argument 'use_uid' after an \ - name: Insert a new rule pam_wheel.so with argument 'use_uid' after an existing rule pam_rootok.so
existing rule pam_rootok.so
community.general.pamd: community.general.pamd:
name: su name: su
type: auth type: auth
@ -193,8 +183,8 @@ EXAMPLES = r'''
control: '[success=1 default=ignore]' control: '[success=1 default=ignore]'
module_path: pam_succeed_if.so module_path: pam_succeed_if.so
module_arguments: module_arguments:
- crond - crond
- quiet - quiet
state: args_present state: args_present
- name: Module arguments requiring commas must be listed as a Yaml list - name: Module arguments requiring commas must be listed as a Yaml list
@ -204,7 +194,7 @@ EXAMPLES = r'''
control: required control: required
module_path: pam_access.so module_path: pam_access.so
module_arguments: module_arguments:
- listsep=, - listsep=,
state: args_present state: args_present
- name: Update specific argument value in a rule - name: Update specific argument value in a rule
@ -226,21 +216,20 @@ EXAMPLES = r'''
type: auth type: auth
module_path: pam_sss.so module_path: pam_sss.so
control: 'requisite' control: 'requisite'
''' """
RETURN = r''' RETURN = r"""
change_count: change_count:
description: How many rules were changed. description: How many rules were changed.
type: int type: int
sample: 1 sample: 1
returned: success returned: success
backupdest: backupdest:
description: description:
- "The file name of the backup file, if created." - The file name of the backup file, if created.
returned: success returned: success
type: str type: str
... """
'''
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule

View File

@ -9,21 +9,18 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = r''' DOCUMENTATION = r"""
---
author: author:
- Fabrizio Colonna (@ColOfAbRiX) - Fabrizio Colonna (@ColOfAbRiX)
module: parted module: parted
short_description: Configure block device partitions short_description: Configure block device partitions
description: description:
- This module allows configuring block device partition using the C(parted) - This module allows configuring block device partition using the C(parted) command line tool. For a full description of the fields and the
command line tool. For a full description of the fields and the options options check the GNU parted manual.
check the GNU parted manual.
requirements: requirements:
- This module requires C(parted) version 1.8.3 and above. - This module requires C(parted) version 1.8.3 and above.
- Option O(align) (except V(undefined)) requires C(parted) 2.1 or above. - Option O(align) (except V(undefined)) requires C(parted) 2.1 or above.
- If the version of C(parted) is below 3.1, it requires a Linux version running - If the version of C(parted) is below 3.1, it requires a Linux version running the C(sysfs) file system C(/sys/).
the C(sysfs) file system C(/sys/).
- Requires the C(resizepart) command when using the O(resize) parameter. - Requires the C(resizepart) command when using the O(resize) parameter.
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
@ -36,15 +33,14 @@ options:
device: device:
description: description:
- The block device (disk) where to operate. - The block device (disk) where to operate.
- Regular files can also be partitioned, but it is recommended to create a - Regular files can also be partitioned, but it is recommended to create a loopback device using C(losetup) to easily access its partitions.
loopback device using C(losetup) to easily access its partitions.
type: str type: str
required: true required: true
align: align:
description: description:
- Set alignment for newly created partitions. Use V(undefined) for parted default alignment. - Set alignment for newly created partitions. Use V(undefined) for parted default alignment.
type: str type: str
choices: [ cylinder, minimal, none, optimal, undefined ] choices: [cylinder, minimal, none, optimal, undefined]
default: optimal default: optimal
number: number:
description: description:
@ -53,46 +49,40 @@ options:
type: int type: int
unit: unit:
description: description:
- Selects the current default unit that Parted will use to display - Selects the current default unit that Parted will use to display locations and capacities on the disk and to interpret those given by
locations and capacities on the disk and to interpret those given by the the user if they are not suffixed by an unit.
user if they are not suffixed by an unit.
- When fetching information about a disk, it is recommended to always specify a unit. - When fetching information about a disk, it is recommended to always specify a unit.
type: str type: str
choices: [ s, B, KB, KiB, MB, MiB, GB, GiB, TB, TiB, '%', cyl, chs, compact ] choices: [s, B, KB, KiB, MB, MiB, GB, GiB, TB, TiB, '%', cyl, chs, compact]
default: KiB default: KiB
label: label:
description: description:
- Disk label type or partition table to use. - Disk label type or partition table to use.
- If O(device) already contains a different label, it will be changed to O(label) - If O(device) already contains a different label, it will be changed to O(label) and any previous partitions will be lost.
and any previous partitions will be lost.
- A O(name) must be specified for a V(gpt) partition table. - A O(name) must be specified for a V(gpt) partition table.
type: str type: str
choices: [ aix, amiga, bsd, dvh, gpt, loop, mac, msdos, pc98, sun ] choices: [aix, amiga, bsd, dvh, gpt, loop, mac, msdos, pc98, sun]
default: msdos default: msdos
part_type: part_type:
description: description:
- May be specified only with O(label=msdos) or O(label=dvh). - May be specified only with O(label=msdos) or O(label=dvh).
- Neither O(part_type) nor O(name) may be used with O(label=sun). - Neither O(part_type) nor O(name) may be used with O(label=sun).
type: str type: str
choices: [ extended, logical, primary ] choices: [extended, logical, primary]
default: primary default: primary
part_start: part_start:
description: description:
- Where the partition will start as offset from the beginning of the disk, - Where the partition will start as offset from the beginning of the disk, that is, the "distance" from the start of the disk. Negative
that is, the "distance" from the start of the disk. Negative numbers numbers specify distance from the end of the disk.
specify distance from the end of the disk. - The distance can be specified with all the units supported by parted (except compat) and it is case sensitive, for example V(10GiB), V(15%).
- The distance can be specified with all the units supported by parted
(except compat) and it is case sensitive, for example V(10GiB), V(15%).
- Using negative values may require setting of O(fs_type) (see notes). - Using negative values may require setting of O(fs_type) (see notes).
type: str type: str
default: 0% default: 0%
part_end: part_end:
description: description:
- Where the partition will end as offset from the beginning of the disk, - Where the partition will end as offset from the beginning of the disk, that is, the "distance" from the start of the disk. Negative numbers
that is, the "distance" from the start of the disk. Negative numbers
specify distance from the end of the disk. specify distance from the end of the disk.
- The distance can be specified with all the units supported by parted - The distance can be specified with all the units supported by parted (except compat) and it is case sensitive, for example V(10GiB), V(15%).
(except compat) and it is case sensitive, for example V(10GiB), V(15%).
type: str type: str
default: 100% default: 100%
name: name:
@ -108,7 +98,7 @@ options:
- Whether to create or delete a partition. - Whether to create or delete a partition.
- If set to V(info) the module will only return the device information. - If set to V(info) the module will only return the device information.
type: str type: str
choices: [ absent, present, info ] choices: [absent, present, info]
default: info default: info
fs_type: fs_type:
description: description:
@ -124,18 +114,15 @@ options:
version_added: '1.3.0' version_added: '1.3.0'
notes: notes:
- When fetching information about a new disk and when the version of parted - When fetching information about a new disk and when the version of parted installed on the system is before version 3.1, the module queries
installed on the system is before version 3.1, the module queries the kernel the kernel through C(/sys/) to obtain disk information. In this case the units CHS and CYL are not supported.
through C(/sys/) to obtain disk information. In this case the units CHS and - Negative O(part_start) start values were rejected if O(fs_type) was not given. This bug was fixed in parted 3.2.153. If you want to use negative
CYL are not supported. O(part_start), specify O(fs_type) as well or make sure your system contains newer parted.
- Negative O(part_start) start values were rejected if O(fs_type) was not given. """
This bug was fixed in parted 3.2.153. If you want to use negative O(part_start),
specify O(fs_type) as well or make sure your system contains newer parted.
'''
RETURN = r''' RETURN = r"""
partition_info: partition_info:
description: Current partition information description: Current partition information.
returned: success returned: success
type: complex type: complex
contains: contains:
@ -146,7 +133,7 @@ partition_info:
description: List of device partitions. description: List of device partitions.
type: list type: list
script: script:
description: parted script executed by module description: Parted script executed by module.
type: str type: str
sample: { sample: {
"disk": { "disk": {
@ -177,9 +164,9 @@ partition_info:
}], }],
"script": "unit KiB print " "script": "unit KiB print "
} }
''' """
EXAMPLES = r''' EXAMPLES = r"""
- name: Create a new ext4 primary partition - name: Create a new ext4 primary partition
community.general.parted: community.general.parted:
device: /dev/sdb device: /dev/sdb
@ -204,7 +191,7 @@ EXAMPLES = r'''
community.general.parted: community.general.parted:
device: /dev/sdb device: /dev/sdb
number: 2 number: 2
flags: [ lvm ] flags: [lvm]
state: present state: present
part_start: 1GiB part_start: 1GiB
@ -235,7 +222,7 @@ EXAMPLES = r'''
part_end: "100%" part_end: "100%"
resize: true resize: true
state: present state: present
''' """
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule

View File

@ -12,54 +12,53 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r"""
---
module: pear module: pear
short_description: Manage pear/pecl packages short_description: Manage pear/pecl packages
description: description:
- Manage PHP packages with the pear package manager. - Manage PHP packages with the pear package manager.
author: author:
- Jonathan Lestrelin (@jle64) <jonathan.lestrelin@gmail.com> - Jonathan Lestrelin (@jle64) <jonathan.lestrelin@gmail.com>
extends_documentation_fragment: extends_documentation_fragment:
- community.general.attributes - community.general.attributes
attributes: attributes:
check_mode: check_mode:
support: full support: full
diff_mode: diff_mode:
support: none support: none
options: options:
name: name:
type: str type: str
description: description:
- Name of the package to install, upgrade, or remove. - Name of the package to install, upgrade, or remove.
required: true required: true
aliases: [pkg] aliases: [pkg]
state: state:
type: str type: str
description: description:
- Desired state of the package. - Desired state of the package.
default: "present" default: "present"
choices: ["present", "installed", "latest", "absent", "removed"] choices: ["present", "installed", "latest", "absent", "removed"]
executable: executable:
type: path type: path
description: description:
- Path to the pear executable. - Path to the pear executable.
prompts: prompts:
description: description:
- List of regular expressions that can be used to detect prompts during pear package installation to answer the expected question. - List of regular expressions that can be used to detect prompts during pear package installation to answer the expected question.
- Prompts will be processed in the same order as the packages list. - Prompts will be processed in the same order as the packages list.
- You can optionally specify an answer to any question in the list. - You can optionally specify an answer to any question in the list.
- If no answer is provided, the list item will only contain the regular expression. - If no answer is provided, the list item will only contain the regular expression.
- "To specify an answer, the item will be a dict with the regular expression as key and the answer as value C(my_regular_expression: 'an_answer')." - "To specify an answer, the item will be a dict with the regular expression as key and the answer as value C(my_regular_expression: 'an_answer')."
- You can provide a list containing items with or without answer. - You can provide a list containing items with or without answer.
- A prompt list can be shorter or longer than the packages list but will issue a warning. - A prompt list can be shorter or longer than the packages list but will issue a warning.
- If you want to specify that a package will not need prompts in the middle of a list, V(null). - If you want to specify that a package will not need prompts in the middle of a list, V(null).
type: list type: list
elements: raw elements: raw
version_added: 0.2.0 version_added: 0.2.0
''' """
EXAMPLES = r''' EXAMPLES = r"""
- name: Install pear package - name: Install pear package
community.general.pear: community.general.pear:
name: Net_URL2 name: Net_URL2
@ -75,19 +74,18 @@ EXAMPLES = r'''
name: pecl/apcu name: pecl/apcu
state: present state: present
prompts: prompts:
- (.*)Enable internal debugging in APCu \[no\] - (.*)Enable internal debugging in APCu \[no\]
- name: Install pecl package with expected prompt and an answer - name: Install pecl package with expected prompt and an answer
community.general.pear: community.general.pear:
name: pecl/apcu name: pecl/apcu
state: present state: present
prompts: prompts:
- (.*)Enable internal debugging in APCu \[no\]: "yes" - (.*)Enable internal debugging in APCu \[no\]: "yes"
- name: Install multiple pear/pecl packages at once with prompts. - name: Install multiple pear/pecl packages at once with prompts. Prompts will be processed on the same order as the packages order. If there
Prompts will be processed on the same order as the packages order. is more prompts than packages, packages without prompts will be installed without any prompt expected. If there is more packages than prompts,
If there is more prompts than packages, packages without prompts will be installed without any prompt expected. additional prompts will be ignored.
If there is more packages than prompts, additional prompts will be ignored.
community.general.pear: community.general.pear:
name: pecl/gnupg, pecl/apcu name: pecl/gnupg, pecl/apcu
state: present state: present
@ -95,10 +93,9 @@ EXAMPLES = r'''
- I am a test prompt because gnupg doesnt asks anything - I am a test prompt because gnupg doesnt asks anything
- (.*)Enable internal debugging in APCu \[no\]: "yes" - (.*)Enable internal debugging in APCu \[no\]: "yes"
- name: Install multiple pear/pecl packages at once skipping the first prompt. - name: Install multiple pear/pecl packages at once skipping the first prompt. Prompts will be processed on the same order as the packages order.
Prompts will be processed on the same order as the packages order. If there is more prompts than packages, packages without prompts will be installed without any prompt expected. If there is more packages
If there is more prompts than packages, packages without prompts will be installed without any prompt expected. than prompts, additional prompts will be ignored.
If there is more packages than prompts, additional prompts will be ignored.
community.general.pear: community.general.pear:
name: pecl/gnupg, pecl/apcu name: pecl/gnupg, pecl/apcu
state: present state: present
@ -115,7 +112,7 @@ EXAMPLES = r'''
community.general.pear: community.general.pear:
name: Net_URL2,pecl/json_post name: Net_URL2,pecl/json_post
state: absent state: absent
''' """
import os import os