cloudstack: streamline modules doc (part 3) (#53412)

* cloudstack: streamline modules doc (part 3)

* Parameter types added
* Copyright format fixes
* Doc style fixes
* Examples format fixes
* Remove cs_loadbalancer_rule from ignore.txt

* cs_loadbalancer_rule: add "version_added" for params added into the documentation

* cs_loadbalancer_rule: ignore E309 for now

* cs_loadbalancer_rule: remove E309 from ignore.txt
This commit is contained in:
David Passante 2019-03-12 23:19:07 +01:00 committed by René Moser
commit 495c197770
9 changed files with 290 additions and 237 deletions

View file

@ -3,21 +3,7 @@
#
# (c) 2015, Darren Worrall <darren@iweb.co.uk>
# (c) 2015, René Moser <mail@renemoser.net>
#
# 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/>.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
@ -32,96 +18,120 @@ description:
- Add, update and remove load balancer rules.
version_added: '2.0'
author:
- "Darren Worrall (@dazworrall)"
- "René Moser (@resmo)"
- Darren Worrall (@dazworrall)
- René Moser (@resmo)
options:
name:
description:
- The name of the load balancer rule.
type: str
required: true
description:
description:
- The description of the load balancer rule.
type: str
algorithm:
description:
- Load balancer algorithm
- Required when using C(state=present).
choices: [ 'source', 'roundrobin', 'leastconn' ]
default: 'source'
- Required when using I(state=present).
type: str
choices: [ source, roundrobin, leastconn ]
default: source
private_port:
description:
- The private port of the private ip address/virtual machine where the network traffic will be load balanced to.
- Required when using C(state=present).
- Required when using I(state=present).
- Can not be changed once the rule exists due API limitation.
type: int
public_port:
description:
- The public port from where the network traffic will be load balanced from.
- Required when using C(state=present).
- Required when using I(state=present).
- Can not be changed once the rule exists due API limitation.
type: int
required: true
ip_address:
description:
- Public IP address from where the network traffic will be load balanced from.
type: str
required: true
aliases: [ 'public_ip' ]
aliases: [ public_ip ]
open_firewall:
description:
- Whether the firewall rule for public port should be created, while creating the new rule.
- Use M(cs_firewall) for managing firewall rules.
type: bool
default: 'no'
default: no
cidr:
description:
- CIDR (full notation) to be used for firewall rule if required.
type: str
protocol:
description:
- The protocol to be used on the load balancer
type: str
project:
description:
- Name of the project the load balancer IP address is related to.
type: str
state:
description:
- State of the rule.
default: 'present'
choices: [ 'present', 'absent' ]
type: str
default: present
choices: [ present, absent ]
domain:
description:
- Domain the rule is related to.
type: str
account:
description:
- Account the rule is related to.
type: str
zone:
description:
- Name of the zone in which the rule should be created.
- If not set, default zone is used.
type: str
poll_async:
description:
- Poll async jobs until job has finished.
type: bool
default: yes
tags:
description:
- 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. I(tags: [])."
type: list
aliases: [ tag ]
extends_documentation_fragment: cloudstack
'''
EXAMPLES = '''
# Create a load balancer rule
- local_action:
module: cs_loadbalancer_rule
- name: Create a load balancer rule
cs_loadbalancer_rule:
name: balance_http
public_ip: 1.2.3.4
algorithm: leastconn
public_port: 80
private_port: 8080
delegate_to: localhost
# update algorithm of an existing load balancer rule
- local_action:
module: cs_loadbalancer_rule
- name: Update algorithm of an existing load balancer rule
cs_loadbalancer_rule:
name: balance_http
public_ip: 1.2.3.4
algorithm: roundrobin
public_port: 80
private_port: 8080
delegate_to: localhost
# Delete a load balancer rule
- local_action:
module: cs_loadbalancer_rule
- name: Delete a load balancer rule
cs_loadbalancer_rule:
name: balance_http
public_ip: 1.2.3.4
state: absent
delegate_to: localhost
'''
RETURN = '''
@ -155,52 +165,52 @@ algorithm:
description: Load balancer algorithm used.
returned: success
type: str
sample: "source"
sample: source
cidr:
description: CIDR to forward traffic from.
returned: success
type: str
sample: ""
sample: 0.0.0.0/0
name:
description: Name of the rule.
returned: success
type: str
sample: "http-lb"
sample: http-lb
description:
description: Description of the rule.
returned: success
type: str
sample: "http load balancer rule"
sample: http load balancer rule
protocol:
description: Protocol of the rule.
returned: success
type: str
sample: "tcp"
sample: tcp
public_port:
description: Public port.
returned: success
type: str
type: int
sample: 80
private_port:
description: Private IP address.
returned: success
type: str
type: int
sample: 80
public_ip:
description: Public IP address.
returned: success
type: str
sample: "1.2.3.4"
sample: 1.2.3.4
tags:
description: List of resource tags associated with the rule.
returned: success
type: dict
type: list
sample: '[ { "key": "foo", "value": "bar" } ]'
state:
description: State of the rule.
returned: success
type: str
sample: "Add"
sample: Add
'''
from ansible.module_utils.basic import AnsibleModule