cloudstack: streamline modules doc (part 4) (#53874)

* cloudstack: streamline modules doc (part 4)

* Parameter types added
* Copyright format fixes
* Doc style fixes
* Examples format fixes
* validate-module errors fixes

* cs_network_offering: Rollback of the deletion of the choice list for supported_services param
This commit is contained in:
David Passante 2019-03-17 08:38:02 +01:00 committed by René Moser
parent e8972ce459
commit ef6da8ec5c
14 changed files with 278 additions and 244 deletions

View file

@ -19,22 +19,26 @@ module: cs_instance_facts
short_description: Gathering facts from the API of instances from Apache CloudStack based clouds. short_description: Gathering facts from the API of instances from Apache CloudStack based clouds.
description: description:
- Gathering facts from the API of an instance. - Gathering facts from the API of an instance.
version_added: "2.1" version_added: '2.1'
author: "René Moser (@resmo)" author: René Moser (@resmo)
options: options:
name: name:
description: description:
- Name or display name of the instance. - Name or display name of the instance.
type: str
required: true required: true
domain: domain:
description: description:
- Domain the instance is related to. - Domain the instance is related to.
type: str
account: account:
description: description:
- Account the instance is related to. - Account the instance is related to.
type: str
project: project:
description: description:
- Project the instance is related to. - Project the instance is related to.
type: str
extends_documentation_fragment: cloudstack extends_documentation_fragment: cloudstack
''' '''
@ -157,7 +161,7 @@ affinity_groups:
tags: tags:
description: List of resource tags associated with the instance. description: List of resource tags associated with the instance.
returned: success returned: success
type: dict type: list
sample: '[ { "key": "foo", "value": "bar" } ]' sample: '[ { "key": "foo", "value": "bar" } ]'
hypervisor: hypervisor:
description: Hypervisor related to this instance. description: Hypervisor related to this instance.

View file

@ -98,10 +98,11 @@ options:
type: bool type: bool
acl_type: acl_type:
description: description:
- Access control type for the VPC network tier. - Access control type for the network.
- If not specified, Cloudstack will default to C(account) for isolated networks
- and C(domain) for shared networks.
- Only considered on create. - Only considered on create.
type: str type: str
default: account
choices: [ account, domain ] choices: [ account, domain ]
acl: acl:
description: description:
@ -269,7 +270,7 @@ tags:
type: list type: list
sample: '[ { "key": "foo", "value": "bar" } ]' sample: '[ { "key": "foo", "value": "bar" } ]'
acl_type: acl_type:
description: Access type of the VPC network tier (Domain, Account). description: Access type of the network (Domain, Account).
returned: success returned: success
type: str type: str
sample: Account sample: Account

View file

@ -16,37 +16,44 @@ short_description: Manages network offerings on Apache CloudStack based clouds.
description: description:
- Create, update, enable, disable and remove network offerings. - Create, update, enable, disable and remove network offerings.
version_added: '2.5' version_added: '2.5'
author: "David Passante (@dpassante)" author: David Passante (@dpassante)
options: options:
state: state:
description: description:
- State of the network offering. - State of the network offering.
type: str
choices: [ enabled, present, disabled, absent] choices: [ enabled, present, disabled, absent]
default: present default: present
display_text: display_text:
description: description:
- Display text of the network offerings. - Display text of the network offerings.
type: str
guest_ip_type: guest_ip_type:
description: description:
- Guest type of the network offering. - Guest type of the network offering.
type: str
choices: [ Shared, Isolated ] choices: [ Shared, Isolated ]
name: name:
description: description:
- The name of the network offering. - The name of the network offering.
type: str
required: true required: true
supported_services: supported_services:
description: description:
- Services supported by the network offering. - Services supported by the network offering.
- One or more of the choices. - A list of one or more items from the choice list.
type: list
choices: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ] choices: [ Dns, PortForwarding, Dhcp, SourceNat, UserData, Firewall, StaticNat, Vpn, Lb ]
aliases: [ supported_service ] aliases: [ supported_service ]
traffic_type: traffic_type:
description: description:
- The traffic type for the network offering. - The traffic type for the network offering.
type: str
default: Guest default: Guest
availability: availability:
description: description:
- The availability of network offering. Default value is Optional - The availability of network offering. Default value is Optional
type: str
conserve_mode: conserve_mode:
description: description:
- Whether the network offering has IP conserve mode enabled. - Whether the network offering has IP conserve mode enabled.
@ -55,10 +62,11 @@ options:
description: description:
- Network offering details in key/value pairs. - Network offering details in key/value pairs.
- with service provider as a value - with service provider as a value
choices: [ internallbprovider, publiclbprovider ] type: list
egress_default_policy: egress_default_policy:
description: description:
- Whether the default egress policy is allow or to deny. - Whether the default egress policy is allow or to deny.
type: str
choices: [ allow, deny ] choices: [ allow, deny ]
persistent: persistent:
description: description:
@ -74,21 +82,26 @@ options:
max_connections: max_connections:
description: description:
- Maximum number of concurrent connections supported by the network offering. - Maximum number of concurrent connections supported by the network offering.
type: int
network_rate: network_rate:
description: description:
- Data transfer rate in megabits per second allowed. - Data transfer rate in megabits per second allowed.
type: int
service_capabilities: service_capabilities:
description: description:
- Desired service capabilities as part of network offering. - Desired service capabilities as part of network offering.
type: list
aliases: [ service_capability ] aliases: [ service_capability ]
service_offering: service_offering:
description: description:
- The service offering name or ID used by virtual router provider. - The service offering name or ID used by virtual router provider.
service_provider: type: str
service_providers:
description: description:
- Provider to service mapping. - Provider to service mapping.
- If not specified, the provider for the service will be mapped to the default provider on the physical network. - If not specified, the provider for the service will be mapped to the default provider on the physical network.
aliases: [service_provider] type: list
aliases: [ service_provider ]
specify_ip_ranges: specify_ip_ranges:
description: description:
- Wheter the network offering supports specifying IP ranges. - Wheter the network offering supports specifying IP ranges.
@ -103,8 +116,7 @@ extends_documentation_fragment: cloudstack
EXAMPLES = ''' EXAMPLES = '''
- name: Create a network offering and enable it - name: Create a network offering and enable it
local_action: cs_network_offering:
module: cs_network_offering
name: my_network_offering name: my_network_offering
display_text: network offering description display_text: network offering description
state: enabled state: enabled
@ -113,13 +125,14 @@ EXAMPLES = '''
service_providers: service_providers:
- { service: 'dns', provider: 'virtualrouter' } - { service: 'dns', provider: 'virtualrouter' }
- { service: 'dhcp', provider: 'virtualrouter' } - { service: 'dhcp', provider: 'virtualrouter' }
delegate_to: localhost
- name: Remove a network offering - name: Remove a network offering
local_action: cs_network_offering:
module: cs_network_offering
name: my_network_offering name: my_network_offering
state: absent state: absent
delegate_to: localhost
''' '''
RETURN = ''' RETURN = '''

View file

@ -16,73 +16,81 @@ module: cs_pod
short_description: Manages pods on Apache CloudStack based clouds. short_description: Manages pods on Apache CloudStack based clouds.
description: description:
- Create, update, delete pods. - Create, update, delete pods.
version_added: "2.1" version_added: '2.1'
author: "René Moser (@resmo)" author: René Moser (@resmo)
options: options:
name: name:
description: description:
- Name of the pod. - Name of the pod.
type: str
required: true required: true
id: id:
description: description:
- uuid of the existing pod. - uuid of the existing pod.
type: str
start_ip: start_ip:
description: description:
- Starting IP address for the Pod. - Starting IP address for the Pod.
- Required on C(state=present) - Required on I(state=present)
type: str
end_ip: end_ip:
description: description:
- Ending IP address for the Pod. - Ending IP address for the Pod.
type: str
netmask: netmask:
description: description:
- Netmask for the Pod. - Netmask for the Pod.
- Required on C(state=present) - Required on I(state=present)
type: str
gateway: gateway:
description: description:
- Gateway for the Pod. - Gateway for the Pod.
- Required on C(state=present) - Required on I(state=present)
type: str
zone: zone:
description: description:
- Name of the zone in which the pod belongs to. - Name of the zone in which the pod belongs to.
- If not set, default zone is used. - If not set, default zone is used.
type: str
state: state:
description: description:
- State of the pod. - State of the pod.
default: 'present' type: str
choices: [ 'present', 'enabled', 'disabled', 'absent' ] default: present
choices: [ present, enabled, disabled, absent ]
extends_documentation_fragment: cloudstack extends_documentation_fragment: cloudstack
''' '''
EXAMPLES = ''' EXAMPLES = '''
- name: Ensure a pod is present - name: Ensure a pod is present
local_action: cs_pod:
module: cs_pod
name: pod1 name: pod1
zone: ch-zrh-ix-01 zone: ch-zrh-ix-01
start_ip: 10.100.10.101 start_ip: 10.100.10.101
gateway: 10.100.10.1 gateway: 10.100.10.1
netmask: 255.255.255.0 netmask: 255.255.255.0
delegate_to: localhost
- name: Ensure a pod is disabled - name: Ensure a pod is disabled
local_action: cs_pod:
module: cs_pod
name: pod1 name: pod1
zone: ch-zrh-ix-01 zone: ch-zrh-ix-01
state: disabled state: disabled
delegate_to: localhost
- name: Ensure a pod is enabled - name: Ensure a pod is enabled
local_action: cs_pod:
module: cs_pod
name: pod1 name: pod1
zone: ch-zrh-ix-01 zone: ch-zrh-ix-01
state: enabled state: enabled
delegate_to: localhost
- name: Ensure a pod is absent - name: Ensure a pod is absent
local_action: cs_pod:
module: cs_pod
name: pod1 name: pod1
zone: ch-zrh-ix-01 zone: ch-zrh-ix-01
state: absent state: absent
delegate_to: localhost
''' '''
RETURN = ''' RETURN = '''

View file

@ -20,121 +20,136 @@ short_description: Manages port forwarding rules on Apache CloudStack based clou
description: description:
- Create, update and remove port forwarding rules. - Create, update and remove port forwarding rules.
version_added: '2.0' version_added: '2.0'
author: "René Moser (@resmo)" author: René Moser (@resmo)
options: options:
ip_address: ip_address:
description: description:
- Public IP address the rule is assigned to. - Public IP address the rule is assigned to.
type: str
required: true required: true
vm: vm:
description: description:
- Name of virtual machine which we make the port forwarding rule for. - Name of virtual machine which we make the port forwarding rule for.
- Required if C(state=present). - Required if I(state=present).
type: str
state: state:
description: description:
- State of the port forwarding rule. - State of the port forwarding rule.
type: str
default: present default: present
choices: [ present, absent ] choices: [ present, absent ]
protocol: protocol:
description: description:
- Protocol of the port forwarding rule. - Protocol of the port forwarding rule.
type: str
default: tcp default: tcp
choices: [ tcp, udp ] choices: [ tcp, udp ]
public_port: public_port:
description: description:
- Start public port for this rule. - Start public port for this rule.
type: int
required: true required: true
public_end_port: public_end_port:
description: description:
- End public port for this rule. - End public port for this rule.
- If not specified equal C(public_port). - If not specified equal I(public_port).
type: int
private_port: private_port:
description: description:
- Start private port for this rule. - Start private port for this rule.
type: int
required: true required: true
private_end_port: private_end_port:
description: description:
- End private port for this rule. - End private port for this rule.
- If not specified equal C(private_port). - If not specified equal I(private_port).
type: int
open_firewall: open_firewall:
description: description:
- Whether the firewall rule for public port should be created, while creating the new rule. - Whether the firewall rule for public port should be created, while creating the new rule.
- Use M(cs_firewall) for managing firewall rules. - Use M(cs_firewall) for managing firewall rules.
default: false default: no
type: bool type: bool
vm_guest_ip: vm_guest_ip:
description: description:
- VM guest NIC secondary IP address for the port forwarding rule. - VM guest NIC secondary IP address for the port forwarding rule.
default: false type: str
network: network:
description: description:
- Name of the network. - Name of the network.
version_added: "2.3" type: str
version_added: '2.3'
vpc: vpc:
description: description:
- Name of the VPC. - Name of the VPC.
version_added: "2.3" version_added: '2.3'
type: str
domain: domain:
description: description:
- Domain the C(vm) is related to. - Domain the I(vm) is related to.
type: str
account: account:
description: description:
- Account the C(vm) is related to. - Account the I(vm) is related to.
type: str
project: project:
description: description:
- Name of the project the C(vm) is located in. - Name of the project the I(vm) is located in.
type: str
zone: zone:
description: description:
- Name of the zone in which the virtual machine is in. - Name of the zone in which the virtual machine is in.
- If not set, default zone is used. - If not set, default zone is used.
type: str
poll_async: poll_async:
description: description:
- Poll async jobs until job has finished. - Poll async jobs until job has finished.
default: true default: yes
type: bool type: bool
tags: tags:
description: description:
- List of tags. Tags are a list of dictionaries having keys C(key) and C(value). - List of tags. Tags are a list of dictionaries having keys I(key) and I(value).
- "To delete all tags, set a empty list e.g. C(tags: [])." - "To delete all tags, set a empty list e.g. I(tags: [])."
type: list
aliases: [ tag ] aliases: [ tag ]
version_added: "2.4" version_added: '2.4'
extends_documentation_fragment: cloudstack extends_documentation_fragment: cloudstack
''' '''
EXAMPLES = ''' EXAMPLES = '''
- name: 1.2.3.4:80 -> web01:8080 - name: 1.2.3.4:80 -> web01:8080
local_action: cs_portforward:
module: cs_portforward
ip_address: 1.2.3.4 ip_address: 1.2.3.4
vm: web01 vm: web01
public_port: 80 public_port: 80
private_port: 8080 private_port: 8080
delegate_to: localhost
- name: forward SSH and open firewall - name: forward SSH and open firewall
local_action: cs_portforward:
module: cs_portforward
ip_address: '{{ public_ip }}' ip_address: '{{ public_ip }}'
vm: '{{ inventory_hostname }}' vm: '{{ inventory_hostname }}'
public_port: '{{ ansible_ssh_port }}' public_port: '{{ ansible_ssh_port }}'
private_port: 22 private_port: 22
open_firewall: true open_firewall: true
delegate_to: localhost
- name: forward DNS traffic, but do not open firewall - name: forward DNS traffic, but do not open firewall
local_action: cs_portforward:
module: cs_portforward
ip_address: 1.2.3.4 ip_address: 1.2.3.4
vm: '{{ inventory_hostname }}' vm: '{{ inventory_hostname }}'
public_port: 53 public_port: 53
private_port: 53 private_port: 53
protocol: udp protocol: udp
delegate_to: localhost
- name: remove ssh port forwarding - name: remove ssh port forwarding
local_action: cs_portforward:
module: cs_portforward
ip_address: 1.2.3.4 ip_address: 1.2.3.4
public_port: 22 public_port: 22
private_port: 22 private_port: 22
state: absent state: absent
delegate_to: localhost
''' '''
RETURN = ''' RETURN = '''
@ -163,6 +178,7 @@ private_end_port:
description: End port on the virtual machine's IP address. description: End port on the virtual machine's IP address.
returned: success returned: success
type: int type: int
sample: 80
public_port: public_port:
description: Start port on the public IP address. description: Start port on the public IP address.
returned: success returned: success

View file

@ -2,21 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# (c) 2015, René Moser <mail@renemoser.net> # (c) 2015, René Moser <mail@renemoser.net>
# # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
ANSIBLE_METADATA = {'metadata_version': '1.1', ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'], 'status': ['stableinterface'],
@ -30,72 +16,79 @@ short_description: Manages projects on Apache CloudStack based clouds.
description: description:
- Create, update, suspend, activate and remove projects. - Create, update, suspend, activate and remove projects.
version_added: '2.0' version_added: '2.0'
author: "René Moser (@resmo)" author: René Moser (@resmo)
options: options:
name: name:
description: description:
- Name of the project. - Name of the project.
type: str
required: true required: true
display_text: display_text:
description: description:
- Display text of the project. - Display text of the project.
- If not specified, C(name) will be used as C(display_text). - If not specified, I(name) will be used as I(display_text).
type: str
state: state:
description: description:
- State of the project. - State of the project.
default: 'present' type: str
choices: [ 'present', 'absent', 'active', 'suspended' ] default: present
choices: [ present, absent, active, suspended ]
domain: domain:
description: description:
- Domain the project is related to. - Domain the project is related to.
type: str
account: account:
description: description:
- Account the project is related to. - Account the project is related to.
type: str
tags: tags:
description: description:
- List of tags. Tags are a list of dictionaries having keys C(key) and C(value). - List of tags. Tags are a list of dictionaries having keys I(key) and I(value).
- "If you want to delete all tags, set a empty list e.g. C(tags: [])." - "If you want to delete all tags, set a empty list e.g. I(tags: [])."
version_added: "2.2" type: list
aliases: [ tag ]
version_added: '2.2'
poll_async: poll_async:
description: description:
- Poll async jobs until job has finished. - Poll async jobs until job has finished.
type: bool type: bool
default: 'yes' default: yes
extends_documentation_fragment: cloudstack extends_documentation_fragment: cloudstack
''' '''
EXAMPLES = ''' EXAMPLES = '''
# Create a project - name: Create a project
- local_action: cs_project:
module: cs_project
name: web name: web
tags: tags:
- { key: admin, value: john } - { key: admin, value: john }
- { key: foo, value: bar } - { key: foo, value: bar }
delegate_to: localhost
# Rename a project - name: Rename a project
- local_action: cs_project:
module: cs_project
name: web name: web
display_text: my web project display_text: my web project
delegate_to: localhost
# Suspend an existing project - name: Suspend an existing project
- local_action: cs_project:
module: cs_project
name: web name: web
state: suspended state: suspended
delegate_to: localhost
# Activate an existing project - name: Activate an existing project
- local_action: cs_project:
module: cs_project
name: web name: web
state: active state: active
delegate_to: localhost
# Remove a project - name: Remove a project
- local_action: cs_project:
module: cs_project
name: web name: web
state: absent state: absent
delegate_to: localhost
''' '''
RETURN = ''' RETURN = '''
@ -133,7 +126,7 @@ account:
tags: tags:
description: List of resource tags associated with the project. description: List of resource tags associated with the project.
returned: success returned: success
type: dict type: list
sample: '[ { "key": "foo", "value": "bar" } ]' sample: '[ { "key": "foo", "value": "bar" } ]'
''' '''

View file

@ -2,21 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# (c) 2016, René Moser <mail@renemoser.net> # (c) 2016, René Moser <mail@renemoser.net>
# # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
ANSIBLE_METADATA = {'metadata_version': '1.1', ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'], 'status': ['preview'],
@ -29,43 +15,47 @@ module: cs_region
short_description: Manages regions on Apache CloudStack based clouds. short_description: Manages regions on Apache CloudStack based clouds.
description: description:
- Add, update and remove regions. - Add, update and remove regions.
version_added: "2.3" version_added: '2.3'
author: "René Moser (@resmo)" author: René Moser (@resmo)
options: options:
id: id:
description: description:
- ID of the region. - ID of the region.
- Must be an number (int). - Must be an number (int).
type: int
required: true required: true
name: name:
description: description:
- Name of the region. - Name of the region.
- Required if C(state=present) - Required if I(state=present)
type: str
endpoint: endpoint:
description: description:
- Endpoint URL of the region. - Endpoint URL of the region.
- Required if C(state=present) - Required if I(state=present)
type: str
state: state:
description: description:
- State of the region. - State of the region.
default: 'present' type: str
choices: [ 'present', 'absent' ] default: present
choices: [ present, absent ]
extends_documentation_fragment: cloudstack extends_documentation_fragment: cloudstack
''' '''
EXAMPLES = ''' EXAMPLES = '''
# create a region - name: create a region
- local_action: cs_region:
module: cs_region
id: 2 id: 2
name: geneva name: geneva
endpoint: https://cloud.gva.example.com endpoint: https://cloud.gva.example.com
delegate_to: localhost
# remove a region with ID 2 - name: remove a region with ID 2
- local_action: cs_region:
module: cs_region
id: 2 id: 2
state: absent state: absent
delegate_to: localhost
''' '''
RETURN = ''' RETURN = '''

View file

@ -15,12 +15,13 @@ module: cs_resourcelimit
short_description: Manages resource limits on Apache CloudStack based clouds. short_description: Manages resource limits on Apache CloudStack based clouds.
description: description:
- Manage limits of resources for domains, accounts and projects. - Manage limits of resources for domains, accounts and projects.
version_added: "2.1" version_added: '2.1'
author: "René Moser (@resmo)" author: René Moser (@resmo)
options: options:
resource_type: resource_type:
description: description:
- Type of the resource. - Type of the resource.
type: str
required: true required: true
choices: choices:
- instance - instance
@ -34,40 +35,44 @@ options:
- memory - memory
- primary_storage - primary_storage
- secondary_storage - secondary_storage
aliases: [ 'type' ] aliases: [ type ]
limit: limit:
description: description:
- Maximum number of the resource. - Maximum number of the resource.
- Default is unlimited C(-1). - Default is unlimited C(-1).
type: int
default: -1 default: -1
aliases: [ 'max' ] aliases: [ max ]
domain: domain:
description: description:
- Domain the resource is related to. - Domain the resource is related to.
type: str
account: account:
description: description:
- Account the resource is related to. - Account the resource is related to.
type: str
project: project:
description: description:
- Name of the project the resource is related to. - Name of the project the resource is related to.
type: str
extends_documentation_fragment: cloudstack extends_documentation_fragment: cloudstack
''' '''
EXAMPLES = ''' EXAMPLES = '''
- name: Update a resource limit for instances of a domain - name: Update a resource limit for instances of a domain
local_action: cs_resourcelimit:
module: cs_resourcelimit
type: instance type: instance
limit: 10 limit: 10
domain: customers domain: customers
delegate_to: localhost
- name: Update a resource limit for instances of an account - name: Update a resource limit for instances of an account
local_action: cs_resourcelimit:
module: cs_resourcelimit
type: instance type: instance
limit: 12 limit: 12
account: moserre account: moserre
domain: customers domain: customers
delegate_to: localhost
''' '''
RETURN = ''' RETURN = '''

View file

@ -2,21 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# (c) 2016, René Moser <mail@renemoser.net> # (c) 2016, René Moser <mail@renemoser.net>
# # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
ANSIBLE_METADATA = {'metadata_version': '1.1', ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'], 'status': ['preview'],
@ -29,52 +15,57 @@ module: cs_role
short_description: Manages user roles on Apache CloudStack based clouds. short_description: Manages user roles on Apache CloudStack based clouds.
description: description:
- Create, update, delete user roles. - Create, update, delete user roles.
version_added: "2.3" version_added: '2.3'
author: "René Moser (@resmo)" author: René Moser (@resmo)
options: options:
name: name:
description: description:
- Name of the role. - Name of the role.
type: str
required: true required: true
id: id:
description: description:
- ID of the role. - ID of the role.
- If provided, C(id) is used as key. - If provided, I(id) is used as key.
aliases: [ 'uuid' ] type: str
aliases: [ uuid ]
role_type: role_type:
description: description:
- Type of the role. - Type of the role.
- Only considered for creation. - Only considered for creation.
type: str
default: User default: User
choices: [ 'User', 'DomainAdmin', 'ResourceAdmin', 'Admin' ] choices: [ User, DomainAdmin, ResourceAdmin, Admin ]
description: description:
description: description:
- Description of the role. - Description of the role.
type: str
state: state:
description: description:
- State of the role. - State of the role.
default: 'present' type: str
choices: [ 'present', 'absent' ] default: present
choices: [ present, absent ]
extends_documentation_fragment: cloudstack extends_documentation_fragment: cloudstack
''' '''
EXAMPLES = ''' EXAMPLES = '''
# Ensure an user role is present - name: Ensure an user role is present
- local_action: cs_role:
module: cs_role
name: myrole_user name: myrole_user
delegate_to: localhost
# Ensure a role having particular ID is named as myrole_user - name: Ensure a role having particular ID is named as myrole_user
- local_action: cs_role:
module: cs_role
name: myrole_user name: myrole_user
id: 04589590-ac63-4ffc-93f5-b698b8ac38b6 id: 04589590-ac63-4ffc-93f5-b698b8ac38b6
delegate_to: localhost
# Ensure a role is absent - name: Ensure a role is absent
- local_action: cs_role:
module: cs_role
name: myrole_user name: myrole_user
state: absent state: absent
delegate_to: localhost
''' '''
RETURN = ''' RETURN = '''

View file

@ -16,64 +16,70 @@ description:
- Create, update and remove CloudStack role permissions. - Create, update and remove CloudStack role permissions.
- Managing role permissions only supported in CloudStack >= 4.9. - Managing role permissions only supported in CloudStack >= 4.9.
version_added: '2.6' version_added: '2.6'
author: "David Passante (@dpassante)" author: David Passante (@dpassante)
options: options:
name: name:
description: description:
- The API name of the permission. - The API name of the permission.
type: str
required: true required: true
role: role:
description: description:
- Name or ID of the role. - Name or ID of the role.
type: str
required: true required: true
permission: permission:
description: description:
- The rule permission, allow or deny. Defaulted to deny. - The rule permission, allow or deny. Defaulted to deny.
type: str
choices: [ allow, deny ] choices: [ allow, deny ]
default: deny default: deny
state: state:
description: description:
- State of the role permission. - State of the role permission.
type: str
choices: [ present, absent ] choices: [ present, absent ]
default: present default: present
description: description:
description: description:
- The description of the role permission. - The description of the role permission.
type: str
parent: parent:
description: description:
- The parent role permission uuid. use 0 to move this rule at the top of the list. - The parent role permission uuid. use 0 to move this rule at the top of the list.
type: str
extends_documentation_fragment: cloudstack extends_documentation_fragment: cloudstack
''' '''
EXAMPLES = ''' EXAMPLES = '''
# Create a role permission - name: Create a role permission
- local_action: cs_role_permission:
module: cs_role_permission role: My_Custom_role
role: "My_Custom_role" name: createVPC
name: "createVPC" permission: allow
permission: "allow" description: My comments
description: "My comments" delegate_to: localhost
# Remove a role permission - name: Remove a role permission
- local_action: cs_role_permission:
module: cs_role_permission
state: absent state: absent
role: "My_Custom_role" role: My_Custom_role
name: "createVPC" name: createVPC
delegate_to: localhost
# Update a system role permission - name: Update a system role permission
- local_action: cs_role_permission:
module: cs_role_permission role: Domain Admin
role: "Domain Admin" name: createVPC
name: "createVPC" permission: deny
permission: "deny" delegate_to: localhost
# Update rules order. Move the rule at the top of list - name: Update rules order. Move the rule at the top of list
- local_action: cs_role_permission:
module: cs_role_permission role: Domain Admin
role: "Domain Admin" name: createVPC
name: "createVPC"
parent: 0 parent: 0
delegate_to: localhost
''' '''
RETURN = ''' RETURN = '''

View file

@ -2,21 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# #
# (c) 2016, René Moser <mail@renemoser.net> # (c) 2016, René Moser <mail@renemoser.net>
# # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
ANSIBLE_METADATA = {'metadata_version': '1.1', ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'], 'status': ['stableinterface'],
@ -29,36 +15,43 @@ module: cs_router
short_description: Manages routers on Apache CloudStack based clouds. short_description: Manages routers on Apache CloudStack based clouds.
description: description:
- Start, restart, stop and destroy routers. - Start, restart, stop and destroy routers.
- C(state=present) is not able to create routers, use M(cs_network) instead. - I(state=present) is not able to create routers, use M(cs_network) instead.
version_added: "2.2" version_added: '2.2'
author: "René Moser (@resmo)" author: René Moser (@resmo)
options: options:
name: name:
description: description:
- Name of the router. - Name of the router.
type: str
required: true required: true
service_offering: service_offering:
description: description:
- Name or id of the service offering of the router. - Name or id of the service offering of the router.
type: str
domain: domain:
description: description:
- Domain the router is related to. - Domain the router is related to.
type: str
account: account:
description: description:
- Account the router is related to. - Account the router is related to.
type: str
project: project:
description: description:
- Name of the project the router is related to. - Name of the project the router is related to.
type: str
zone: zone:
description: description:
- Name of the zone the router is deployed in. - Name of the zone the router is deployed in.
- If not set, all zones are used. - If not set, all zones are used.
version_added: "2.4" type: str
version_added: '2.4'
state: state:
description: description:
- State of the router. - State of the router.
default: 'present' type: str
choices: [ 'present', 'absent', 'started', 'stopped', 'restarted' ] default: present
choices: [ present, absent, started, stopped, restarted ]
poll_async: poll_async:
description: description:
- Poll async jobs until job has finished. - Poll async jobs until job has finished.
@ -70,36 +63,38 @@ extends_documentation_fragment: cloudstack
EXAMPLES = ''' EXAMPLES = '''
# Ensure the router has the desired service offering, no matter if # Ensure the router has the desired service offering, no matter if
# the router is running or not. # the router is running or not.
- local_action: - name: Present router
module: cs_router cs_router:
name: r-40-VM name: r-40-VM
service_offering: System Offering for Software Router service_offering: System Offering for Software Router
delegate_to: localhost
# Ensure started - name: Ensure started
- local_action: cs_router:
module: cs_router
name: r-40-VM name: r-40-VM
state: started state: started
delegate_to: localhost
# Ensure started with desired service offering. # Ensure started with desired service offering.
# If the service offerings changes, router will be rebooted. # If the service offerings changes, router will be rebooted.
- local_action: - name: Ensure started with desired service offering
module: cs_router cs_router:
name: r-40-VM name: r-40-VM
service_offering: System Offering for Software Router service_offering: System Offering for Software Router
state: started state: started
delegate_to: localhost
# Ensure stopped - name: Ensure stopped
- local_action: cs_router:
module: cs_router
name: r-40-VM name: r-40-VM
state: stopped state: stopped
delegate_to: localhost
# Remove a router - name: Remove a router
- local_action: cs_router:
module: cs_router
name: r-40-VM name: r-40-VM
state: absent state: absent
delegate_to: localhost
''' '''
RETURN = ''' RETURN = '''

View file

@ -20,44 +20,50 @@ short_description: Manages security groups on Apache CloudStack based clouds.
description: description:
- Create and remove security groups. - Create and remove security groups.
version_added: '2.0' version_added: '2.0'
author: "René Moser (@resmo)" author: René Moser (@resmo)
options: options:
name: name:
description: description:
- Name of the security group. - Name of the security group.
type: str
required: true required: true
description: description:
description: description:
- Description of the security group. - Description of the security group.
type: str
state: state:
description: description:
- State of the security group. - State of the security group.
type: str
default: present default: present
choices: [ present, absent ] choices: [ present, absent ]
domain: domain:
description: description:
- Domain the security group is related to. - Domain the security group is related to.
type: str
account: account:
description: description:
- Account the security group is related to. - Account the security group is related to.
type: str
project: project:
description: description:
- Name of the project the security group to be created in. - Name of the project the security group to be created in.
type: str
extends_documentation_fragment: cloudstack extends_documentation_fragment: cloudstack
''' '''
EXAMPLES = ''' EXAMPLES = '''
- name: create a security group - name: create a security group
local_action: cs_securitygroup:
module: cs_securitygroup
name: default name: default
description: default security group description: default security group
delegate_to: localhost
- name: remove a security group - name: remove a security group
local_action: cs_securitygroup:
module: cs_securitygroup
name: default name: default
state: absent state: absent
delegate_to: localhost
''' '''
RETURN = ''' RETURN = '''
@ -80,7 +86,7 @@ description:
tags: tags:
description: List of resource tags associated with the security group. description: List of resource tags associated with the security group.
returned: success returned: success
type: dict type: list
sample: '[ { "key": "foo", "value": "bar" } ]' sample: '[ { "key": "foo", "value": "bar" } ]'
project: project:
description: Name of project the security group is related to. description: Name of project the security group is related to.

View file

@ -20,54 +20,65 @@ short_description: Manages security group rules on Apache CloudStack based cloud
description: description:
- Add and remove security group rules. - Add and remove security group rules.
version_added: '2.0' version_added: '2.0'
author: "René Moser (@resmo)" author: René Moser (@resmo)
options: options:
security_group: security_group:
description: description:
- Name of the security group the rule is related to. The security group must be existing. - Name of the security group the rule is related to. The security group must be existing.
type: str
required: true required: true
state: state:
description: description:
- State of the security group rule. - State of the security group rule.
type: str
default: present default: present
choices: [ present, absent ] choices: [ present, absent ]
protocol: protocol:
description: description:
- Protocol of the security group rule. - Protocol of the security group rule.
type: str
default: tcp default: tcp
choices: [ tcp, udp, icmp, ah, esp, gre ] choices: [ tcp, udp, icmp, ah, esp, gre ]
type: type:
description: description:
- Ingress or egress security group rule. - Ingress or egress security group rule.
type: str
default: ingress default: ingress
choices: [ ingress, egress ] choices: [ ingress, egress ]
cidr: cidr:
description: description:
- CIDR (full notation) to be used for security group rule. - CIDR (full notation) to be used for security group rule.
default: '0.0.0.0/0' type: str
default: 0.0.0.0/0
user_security_group: user_security_group:
description: description:
- Security group this rule is based of. - Security group this rule is based of.
type: str
start_port: start_port:
description: description:
- Start port for this rule. Required if C(protocol=tcp) or C(protocol=udp). - Start port for this rule. Required if I(protocol=tcp) or I(protocol=udp).
type: int
aliases: [ port ] aliases: [ port ]
end_port: end_port:
description: description:
- End port for this rule. Required if C(protocol=tcp) or C(protocol=udp), but C(start_port) will be used if not set. - End port for this rule. Required if I(protocol=tcp) or I(protocol=udp), but I(start_port) will be used if not set.
type: int
icmp_type: icmp_type:
description: description:
- Type of the icmp message being sent. Required if C(protocol=icmp). - Type of the icmp message being sent. Required if I(protocol=icmp).
type: int
icmp_code: icmp_code:
description: description:
- Error code for this icmp message. Required if C(protocol=icmp). - Error code for this icmp message. Required if I(protocol=icmp).
type: int
project: project:
description: description:
- Name of the project the security group to be created in. - Name of the project the security group to be created in.
type: str
poll_async: poll_async:
description: description:
- Poll async jobs until job has finished. - Poll async jobs until job has finished.
default: true default: yes
type: bool type: bool
extends_documentation_fragment: cloudstack extends_documentation_fragment: cloudstack
''' '''
@ -75,15 +86,14 @@ extends_documentation_fragment: cloudstack
EXAMPLES = ''' EXAMPLES = '''
--- ---
- name: allow inbound port 80/tcp from 1.2.3.4 added to security group 'default' - name: allow inbound port 80/tcp from 1.2.3.4 added to security group 'default'
local_action: cs_securitygroup_rule:
module: cs_securitygroup_rule
security_group: default security_group: default
port: 80 port: 80
cidr: 1.2.3.4/32 cidr: 1.2.3.4/32
delegate_to: localhost
- name: allow tcp/udp outbound added to security group 'default' - name: allow tcp/udp outbound added to security group 'default'
local_action: cs_securitygroup_rule:
module: cs_securitygroup_rule
security_group: default security_group: default
type: egress type: egress
start_port: 1 start_port: 1
@ -92,28 +102,29 @@ EXAMPLES = '''
with_items: with_items:
- tcp - tcp
- udp - udp
delegate_to: localhost
- name: allow inbound icmp from 0.0.0.0/0 added to security group 'default' - name: allow inbound icmp from 0.0.0.0/0 added to security group 'default'
local_action: cs_securitygroup_rule:
module: cs_securitygroup_rule
security_group: default security_group: default
protocol: icmp protocol: icmp
icmp_code: -1 icmp_code: -1
icmp_type: -1 icmp_type: -1
delegate_to: localhost
- name: remove rule inbound port 80/tcp from 0.0.0.0/0 from security group 'default' - name: remove rule inbound port 80/tcp from 0.0.0.0/0 from security group 'default'
local_action: cs_securitygroup_rule:
module: cs_securitygroup_rule
security_group: default security_group: default
port: 80 port: 80
state: absent state: absent
delegate_to: localhost
- name: allow inbound port 80/tcp from security group web added to security group 'default' - name: allow inbound port 80/tcp from security group web added to security group 'default'
local_action: cs_securitygroup_rule:
module: cs_securitygroup_rule
security_group: default security_group: default
port: 80 port: 80
user_security_group: web user_security_group: web
delegate_to: localhost
''' '''
RETURN = ''' RETURN = '''

View file

@ -98,11 +98,6 @@ lib/ansible/modules/cloud/centurylink/clc_firewall_policy.py E335
lib/ansible/modules/cloud/centurylink/clc_server_snapshot.py E335 lib/ansible/modules/cloud/centurylink/clc_server_snapshot.py E335
lib/ansible/modules/cloud/cloudstack/cs_cluster.py E326 lib/ansible/modules/cloud/cloudstack/cs_cluster.py E326
lib/ansible/modules/cloud/cloudstack/cs_host.py E326 lib/ansible/modules/cloud/cloudstack/cs_host.py E326
lib/ansible/modules/cloud/cloudstack/cs_network.py E324
lib/ansible/modules/cloud/cloudstack/cs_network_offering.py E322
lib/ansible/modules/cloud/cloudstack/cs_network_offering.py E326
lib/ansible/modules/cloud/cloudstack/cs_portforward.py E324
lib/ansible/modules/cloud/cloudstack/cs_project.py E322
lib/ansible/modules/cloud/cloudstack/cs_service_offering.py E322 lib/ansible/modules/cloud/cloudstack/cs_service_offering.py E322
lib/ansible/modules/cloud/cloudstack/cs_service_offering.py E323 lib/ansible/modules/cloud/cloudstack/cs_service_offering.py E323
lib/ansible/modules/cloud/cloudstack/cs_service_offering.py E326 lib/ansible/modules/cloud/cloudstack/cs_service_offering.py E326