1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

cloudstack: streamline modules doc (part 2) (#52730)

* cloudstack: streamline modules doc (part 2)

* Parameter types added
* Copyright format fixes
* Doc style fixes
* Examples format fixes

* minor fixes

* fix missing quoting of "version_added"
This commit is contained in:
David Passante 2019-02-28 13:27:14 +01:00 committed by ansibot
parent 88e8330e3e
commit 644362d0be
8 changed files with 206 additions and 187 deletions

View file

@ -71,20 +71,20 @@ options:
description:
- Creates the account under the specified role name or id.
type: str
version_added: 2.8
version_added: '2.8'
ldap_domain:
description:
- Name of the LDAP group or OU to bind.
- If set, account will be linked to LDAP.
type: str
version_added: 2.8
version_added: '2.8'
ldap_type:
description:
- Type of the ldap name. GROUP or OU, defaults to GROUP.
type: str
choices: [ GROUP, OU ]
default: GROUP
version_added: 2.8
version_added: '2.8'
state:
description:
- State of the account.

View file

@ -2,21 +2,7 @@
# -*- coding: utf-8 -*-
#
# (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'],
@ -30,11 +16,12 @@ short_description: Gather facts on instances of Apache CloudStack based clouds.
description:
- This module fetches data from the metadata API in CloudStack. The module must be called from within the instance itself.
version_added: '2.0'
author: "René Moser (@resmo)"
author: René Moser (@resmo)
options:
filter:
description:
- Filter for a specific fact.
type: str
choices:
- cloudstack_service_offering
- cloudstack_availability_zone
@ -48,8 +35,9 @@ options:
description:
- Host or IP of the meta data API service.
- If not set, determination by parsing the dhcp lease file.
version_added: "2.4"
requirements: [ 'yaml' ]
type: str
version_added: '2.4'
requirements: [ yaml ]
'''
EXAMPLES = '''
@ -91,7 +79,7 @@ cloudstack_local_ipv4:
type: str
sample: 185.19.28.35
cloudstack_public_hostname:
description: public IPv4 of the router. Same as C(cloudstack_public_ipv4).
description: public IPv4 of the router. Same as I(cloudstack_public_ipv4).
returned: success
type: str
sample: VM-ab4e80b0-3e7e-4936-bdc5-e334ba5b0139

View file

@ -17,123 +17,138 @@ short_description: Manages firewall rules on Apache CloudStack based clouds.
description:
- Creates and removes firewall rules.
version_added: '2.0'
author: "René Moser (@resmo)"
author: René Moser (@resmo)
options:
ip_address:
description:
- Public IP address the ingress rule is assigned to.
- Required if C(type=ingress).
- Required if I(type=ingress).
type: str
network:
description:
- Network the egress rule is related to.
- Required if C(type=egress).
- Required if I(type=egress).
type: str
state:
description:
- State of the firewall rule.
type: str
default: present
choices: [ present, absent ]
type:
description:
- Type of the firewall rule.
type: str
default: ingress
choices: [ ingress, egress ]
protocol:
description:
- Protocol of the firewall rule.
- C(all) is only available if C(type=egress).
- C(all) is only available if I(type=egress).
type: str
default: tcp
choices: [ tcp, udp, icmp, all ]
cidrs:
description:
- List of CIDRs (full notation) to be used for firewall rule.
- Since version 2.5, it is a list of CIDR.
type: list
default: 0.0.0.0/0
aliases: [ cidr ]
start_port:
description:
- Start port for this rule.
- Considered if C(protocol=tcp) or C(protocol=udp).
- Considered if I(protocol=tcp) or I(protocol=udp).
type: int
aliases: [ port ]
end_port:
description:
- End port for this rule. Considered if C(protocol=tcp) or C(protocol=udp).
- If not specified, equal C(start_port).
- End port for this rule. Considered if I(protocol=tcp) or I(protocol=udp).
- If not specified, equal I(start_port).
type: int
icmp_type:
description:
- Type of the icmp message being sent.
- Considered if C(protocol=icmp).
- Considered if I(protocol=icmp).
type: int
icmp_code:
description:
- Error code for this icmp message.
- Considered if C(protocol=icmp).
- Considered if I(protocol=icmp).
type: int
domain:
description:
- Domain the firewall rule is related to.
type: str
account:
description:
- Account the firewall rule is related to.
type: str
project:
description:
- Name of the project the firewall rule is related to.
type: str
zone:
description:
- Name of the zone in which the virtual machine is in.
- If not set, default zone is used.
type: str
poll_async:
description:
- Poll async jobs until job has finished.
default: true
type: bool
default: yes
tags:
description:
- List of tags. Tags are a list of dictionaries having keys C(key) and C(value).
- "To delete all tags, set a empty list e.g. C(tags: [])."
- List of tags. Tags are a list of dictionaries having keys I(key) and I(value).
- "To delete all tags, set an empty list e.g. I(tags: [])."
type: list
aliases: [ tag ]
version_added: "2.4"
version_added: '2.4'
extends_documentation_fragment: cloudstack
'''
EXAMPLES = '''
- name: Allow inbound port 80/tcp from 1.2.3.4 to 4.3.2.1
local_action:
module: cs_firewall
cs_firewall:
ip_address: 4.3.2.1
port: 80
cidr: 1.2.3.4/32
delegate_to: localhost
- name: Allow inbound tcp/udp port 53 to 4.3.2.1
local_action:
module: cs_firewall
cs_firewall:
ip_address: 4.3.2.1
port: 53
protocol: '{{ item }}'
with_items:
- tcp
- udp
delegate_to: localhost
- name: Ensure firewall rule is removed
local_action:
module: cs_firewall
cs_firewall:
ip_address: 4.3.2.1
start_port: 8000
end_port: 8888
cidr: 17.0.0.0/8
state: absent
delegate_to: localhost
- name: Allow all outbound traffic
local_action:
module: cs_firewall
cs_firewall:
network: my_network
type: egress
protocol: all
delegate_to: localhost
- name: Allow only HTTP outbound traffic for an IP
local_action:
module: cs_firewall
cs_firewall:
network: my_network
type: egress
port: 80
cidr: 10.101.1.20
delegate_to: localhost
'''
RETURN = '''
@ -163,7 +178,7 @@ cidrs:
returned: success
type: list
sample: [ '0.0.0.0/0' ]
version_added: "2.5"
version_added: '2.5'
protocol:
description: Protocol of the rule.
returned: success

View file

@ -2,21 +2,7 @@
# -*- coding: utf-8 -*-
#
# (c) 2016, 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': ['preview'],
@ -29,93 +15,104 @@ module: cs_host
short_description: Manages hosts on Apache CloudStack based clouds.
description:
- Create, update and remove hosts.
version_added: "2.3"
author: "René Moser (@resmo)"
version_added: '2.3'
author: René Moser (@resmo)
options:
name:
description:
- Name of the host.
type: str
required: true
aliases: [ 'ip_address' ]
aliases: [ ip_address ]
url:
description:
- Url of the host used to create a host.
- If not provided, C(http://) and param C(name) is used as url.
- Only considered if C(state=present) and host does not yet exist.
- If not provided, C(http://) and param I(name) is used as url.
- Only considered if I(state=present) and host does not yet exist.
type: str
username:
description:
- Username for the host.
- Required if C(state=present) and host does not yet exist.
- Required if I(state=present) and host does not yet exist.
type: str
password:
description:
- Password for the host.
- Required if C(state=present) and host does not yet exist.
- Required if I(state=present) and host does not yet exist.
type: str
pod:
description:
- Name of the pod.
- Required if C(state=present) and host does not yet exist.
- Required if I(state=present) and host does not yet exist.
type: str
cluster:
description:
- Name of the cluster.
type: str
hypervisor:
description:
- Name of the cluster.
- Required if C(state=present) and host does not yet exist.
choices: [ 'KVM', 'VMware', 'BareMetal', 'XenServer', 'LXC', 'HyperV', 'UCS', 'OVM', 'Simulator' ]
- Required if I(state=present) and host does not yet exist.
type: str
choices: [ KVM, VMware, BareMetal, XenServer, LXC, HyperV, UCS, OVM, Simulator ]
allocation_state:
description:
- Allocation state of the host.
choices: [ 'enabled', 'disabled' ]
type: str
choices: [ enabled, disabled, maintenance ]
host_tags:
description:
- Tags of the host.
type: list
aliases: [ host_tag ]
state:
description:
- State of the host.
default: 'present'
choices: [ 'present', 'absent' ]
type: str
default: present
choices: [ present, absent ]
zone:
description:
- Name of the zone in which the host should be deployed.
- If not set, default zone is used.
type: str
extends_documentation_fragment: cloudstack
'''
EXAMPLES = '''
- name: Ensure a host is present but disabled
local_action:
module: cs_host
name: ix-pod01-esx01.example.com
cluster: vcenter.example.com/ch-zrh-ix/pod01-cluster01
cs_host:
name: pod01.zone01.example.com
cluster: vcenter.example.com/zone01/cluster01
pod: pod01
zone: ch-zrh-ix-01
zone: zone01
hypervisor: VMware
allocation_state: disabled
host_tags:
- perf
- gpu
delegate_to: localhost
- name: Ensure an existing host is disabled
local_action:
module: cs_host
name: ix-pod01-esx01.example.com
zone: ch-zrh-ix-01
cs_host:
name: pod01.zone01.example.com
zone: zone01
allocation_state: disabled
delegate_to: localhost
- name: Ensure an existing host is enabled
local_action:
module: cs_host
name: ix-pod01-esx01.example.com
zone: ch-zrh-ix-01
cs_host:
name: pod01.zone01.example.com
zone: zone01
allocation_state: enabled
delegate_to: localhost
- name: Ensure a host is absent
local_action:
module: cs_host
name: ix-pod01-esx01.example.com
zone: ch-zrh-ix-01
cs_host:
name: pod01.zone01.example.com
zone: zone01
state: absent
delegate_to: localhost
'''
RETURN = '''

View file

@ -20,54 +20,65 @@ short_description: Manages instances and virtual machines on Apache CloudStack b
description:
- Deploy, start, update, scale, restart, restore, stop and destroy instances.
version_added: '2.0'
author: "René Moser (@resmo)"
author: René Moser (@resmo)
options:
name:
description:
- Host name of the instance. C(name) can only contain ASCII letters.
- Name will be generated (UUID) by CloudStack if not specified and can not be changed afterwards.
- Either C(name) or C(display_name) is required.
type: str
display_name:
description:
- Custom display name of the instances.
- Display name will be set to C(name) if not specified.
- Either C(name) or C(display_name) is required.
- Display name will be set to I(name) if not specified.
- Either I(name) or I(display_name) is required.
type: str
group:
description:
- Group in where the new instance should be in.
type: str
state:
description:
- State of the instance.
type: str
default: present
choices: [ deployed, started, stopped, restarted, restored, destroyed, expunged, present, absent ]
service_offering:
description:
- Name or id of the service offering of the new instance.
- If not set, first found service offering is used.
type: str
cpu:
description:
- The number of CPUs to allocate to the instance, used with custom service offerings
type: int
cpu_speed:
description:
- The clock speed/shares allocated to the instance, used with custom service offerings
type: int
memory:
description:
- The memory allocated to the instance, used with custom service offerings
type: int
template:
description:
- Name, display text or id of the template to be used for creating the new instance.
- Required when using I(state=present).
- Mutually exclusive with C(ISO) option.
- Mutually exclusive with I(iso) option.
type: str
iso:
description:
- Name or id of the ISO to be used for creating the new instance.
- Required when using I(state=present).
- Mutually exclusive with C(template) option.
- Mutually exclusive with I(template) option.
type: str
template_filter:
description:
- Name of the filter used to search for the template or iso.
- Used for params C(iso) or C(template) on I(state=present).
- Used for params I(iso) or I(template) on I(state=present).
- The filter C(all) was added in 2.6.
type: str
default: executable
choices: [ all, featured, self, selfexecutable, sharedexecutable, executable, community ]
aliases: [ iso_filter ]
@ -77,71 +88,89 @@ options:
- Name the hypervisor to be used for creating the new instance.
- Relevant when using I(state=present), but only considered if not set on ISO/template.
- If not set or found on ISO/template, first found hypervisor will be used.
type: str
choices: [ KVM, kvm, VMware, vmware, BareMetal, baremetal, XenServer, xenserver, LXC, lxc, HyperV, hyperv, UCS, ucs, OVM, ovm, Simulator, simulator ]
keyboard:
description:
- Keyboard device type for the instance.
type: str
choices: [ 'de', 'de-ch', 'es', 'fi', 'fr', 'fr-be', 'fr-ch', 'is', 'it', 'jp', 'nl-be', 'no', 'pt', 'uk', 'us' ]
networks:
description:
- List of networks to use for the new instance.
type: list
aliases: [ network ]
ip_address:
description:
- IPv4 address for default instance's network during creation.
type: str
ip6_address:
description:
- IPv6 address for default instance's network.
type: str
ip_to_networks:
description:
- "List of mappings in the form I({'network': NetworkName, 'ip': 1.2.3.4})"
- Mutually exclusive with C(networks) option.
- Mutually exclusive with I(networks) option.
type: list
aliases: [ ip_to_network ]
disk_offering:
description:
- Name of the disk offering to be used.
type: str
disk_size:
description:
- Disk size in GByte required if deploying instance from ISO.
type: int
root_disk_size:
description:
- Root disk size in GByte required if deploying instance with KVM hypervisor and want resize the root disk size at startup
(need CloudStack >= 4.4, cloud-initramfs-growroot installed and enabled in the template)
type: int
security_groups:
description:
- List of security groups the instance to be applied to.
type: list
aliases: [ security_group ]
host:
description:
- Host on which an instance should be deployed or started on.
- Only considered when I(state=started) or instance is running.
- Requires root admin privileges.
version_added: 2.6
type: str
version_added: '2.6'
domain:
description:
- Domain the instance is related to.
type: str
account:
description:
- Account the instance is related to.
type: str
project:
description:
- Name of the project the instance to be deployed in.
type: str
zone:
description:
- Name of the zone in which the instance should be deployed.
- If not set, default zone is used.
type: str
ssh_key:
description:
- Name of the SSH key to be deployed on the new instance.
type: str
affinity_groups:
description:
- Affinity groups names to be applied to the new instance.
type: list
aliases: [ affinity_group ]
user_data:
description:
- Optional data (ASCII) that can be sent to the instance upon a successful deployment.
- The data will be automatically base64 encoded.
- Consider switching to HTTP_POST by using I(CLOUDSTACK_METHOD=post) to increase the HTTP_GET size limit of 2KB to 32 KB.
type: str
force:
description:
- Force stop/start the instance if required to apply changes, otherwise a running instance will not be changed.
@ -157,6 +186,7 @@ options:
description:
- List of tags. Tags are a list of dictionaries having keys C(key) and C(value).
- "If you want to delete all tags, set a empty list e.g. I(tags: [])."
type: list
aliases: [ tag ]
poll_async:
description:
@ -166,6 +196,7 @@ options:
details:
description:
- Map to specify custom parameters.
type: dict
version_added: '2.6'
extends_documentation_fragment: cloudstack
'''
@ -280,12 +311,12 @@ password_enabled:
sample: true
password:
description: The password of the instance if exists.
returned: success
returned: if available
type: str
sample: Ge2oe7Do
ssh_key:
description: Name of SSH key deployed to instance.
returned: success
returned: if available
type: str
sample: key@work
domain:
@ -310,18 +341,18 @@ default_ip:
sample: 10.23.37.42
default_ip6:
description: Default IPv6 address of the instance.
returned: success
returned: if available
type: str
sample: 2a04:c43:c00:a07:4b4:beff:fe00:74
version_added: '2.6'
public_ip:
description: Public IP address with instance via static NAT rule.
returned: success
returned: if available
type: str
sample: 1.2.3.4
iso:
description: Name of ISO the instance was deployed with.
returned: success
returned: if available
type: str
sample: Debian-8-64bit
template:
@ -334,7 +365,7 @@ template_display_text:
returned: success
type: str
sample: Linux Debian 9 64-bit 200G Disk (2017-10-08-622866)
version_added: 2.6
version_added: '2.6'
service_offering:
description: Name of the service offering the instance has.
returned: success
@ -363,7 +394,7 @@ affinity_groups:
tags:
description: List of resource tags associated with the instance.
returned: success
type: dict
type: list
sample: '[ { "key": "foo", "value": "bar" } ]'
hypervisor:
description: Hypervisor related to this instance.
@ -375,12 +406,17 @@ host:
returned: success and instance is running
type: str
sample: host-01.example.com
version_added: 2.6
version_added: '2.6'
instance_name:
description: Internal name of the instance (ROOT admin only).
returned: success
type: str
sample: i-44-3992-VM
user-data:
description: Optional data sent to the instance.
returned: success
type: str
sample: VXNlciBkYXRhIGV4YW1wbGUK
'''
import base64

View file

@ -3,21 +3,7 @@
#
# (c) 2017, Marc-Aurèle Brothier @marcaurele
# (c) 2017, 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': ['preview'],
@ -30,72 +16,81 @@ module: cs_instance_nic
short_description: Manages NICs of an instance on Apache CloudStack based clouds.
description:
- Add and remove nic to and from network
version_added: "2.4"
version_added: '2.4'
author:
- "Marc-Aurèle Brothier (@marcaurele)"
- "René Moser (@resmo)"
- Marc-Aurèle Brothier (@marcaurele)
- René Moser (@resmo)
options:
vm:
description:
- Name of instance.
required: true
aliases: ['name']
type: str
aliases: [ name ]
network:
description:
- Name of the network.
type: str
required: true
ip_address:
description:
- IP address to be used for the nic.
type: str
vpc:
description:
- Name of the VPC the C(vm) is related to.
- Name of the VPC the I(vm) is related to.
type: str
domain:
description:
- Domain the instance is related to.
type: str
account:
description:
- Account the instance is related to.
type: str
project:
description:
- Name of the project the instance is deployed in.
type: str
zone:
description:
- Name of the zone in which the instance is deployed in.
- If not set, default zone is used.
type: str
state:
description:
- State of the nic.
default: "present"
choices: [ 'present', 'absent' ]
type: str
default: present
choices: [ present, absent ]
poll_async:
description:
- Poll async jobs until job has finished.
type: bool
default: 'yes'
default: yes
extends_documentation_fragment: cloudstack
'''
EXAMPLES = '''
# Add a nic on another network
- local_action:
module: cs_instance_nic
- name: Add a nic on another network
cs_instance_nic:
vm: privnet
network: privNetForBasicZone
delegate_to: localhost
# Ensure IP address on a nic
- local_action:
module: cs_instance_nic
- name: Ensure IP address on a nic
cs_instance_nic:
vm: privnet
ip_address: 10.10.11.32
network: privNetForBasicZone
delegate_to: localhost
# Remove a secondary nic
- local_action:
module: cs_instance_nic
- name: Remove a secondary nic
cs_instance_nic:
vm: privnet
state: absent
network: privNetForBasicZone
delegate_to: localhost
'''
RETURN = '''

View file

@ -2,21 +2,7 @@
# -*- coding: utf-8 -*-
#
# (c) 2017, 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': ['preview'],
@ -29,71 +15,80 @@ module: cs_instance_nic_secondaryip
short_description: Manages secondary IPs of an instance on Apache CloudStack based clouds.
description:
- Add and remove secondary IPs to and from a NIC of an instance.
version_added: "2.4"
author: "René Moser (@resmo)"
version_added: '2.4'
author: René Moser (@resmo)
options:
vm:
description:
- Name of instance.
type: str
required: true
aliases: [ name ]
network:
description:
- Name of the network.
- Required to find the NIC if instance has multiple networks assigned.
type: str
vm_guest_ip:
description:
- Secondary IP address to be added to the instance nic.
- If not set, the API always returns a new IP address and idempotency is not given.
type: str
aliases: [ secondary_ip ]
vpc:
description:
- Name of the VPC the C(vm) is related to.
- Name of the VPC the I(vm) is related to.
type: str
domain:
description:
- Domain the instance is related to.
type: str
account:
description:
- Account the instance is related to.
type: str
project:
description:
- Name of the project the instance is deployed in.
type: str
zone:
description:
- Name of the zone in which the instance is deployed in.
- If not set, default zone is used.
type: str
state:
description:
- State of the ipaddress.
type: str
default: present
choices: [ present, absent ]
poll_async:
description:
- Poll async jobs until job has finished.
default: true
type: bool
default: yes
extends_documentation_fragment: cloudstack
'''
EXAMPLES = '''
- name: Assign a specific IP to the default NIC of the VM
local_action:
module: cs_instance_nic_secondaryip
cs_instance_nic_secondaryip:
vm: customer_xy
vm_guest_ip: 10.10.10.10
delegate_to: localhost
# Note: If vm_guest_ip is not set, you will get a new IP address on every run.
- name: Assign an IP to the default NIC of the VM
local_action:
module: cs_instance_nic_secondaryip
cs_instance_nic_secondaryip:
vm: customer_xy
delegate_to: localhost
- name: Remove a specific IP from the default NIC
local_action:
module: cs_instance_nic_secondaryip
cs_instance_nic_secondaryip:
vm: customer_xy
vm_guest_ip: 10.10.10.10
state: absent
delegate_to: localhost
'''
RETURN = '''

View file

@ -3,21 +3,7 @@
#
# (c) 2018, Gregor Riepl <onitake@gmail.com>
# based on cs_sshkeypair (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)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
@ -37,51 +23,58 @@ description:
- Requires cloud-init to be installed in the virtual machine.
- The passwordenabled flag must be set on the template associated with the VM.
version_added: '2.8'
author: "Gregor Riepl (@onitake)"
author: Gregor Riepl (@onitake)
options:
vm:
description:
- Name of the virtual machine to reset the password on.
type: str
required: true
domain:
description:
- Name of the domain the virtual machine belongs to.
type: str
account:
description:
- Account the virtual machine belongs to.
type: str
project:
description:
- Name of the project the virtual machine belongs to.
type: str
zone:
description:
- Name of the zone in which the instance is deployed.
- If not set, the default zone is used.
type: str
poll_async:
description:
- Poll async jobs until job has finished.
default: yes
type: bool
default: yes
extends_documentation_fragment: cloudstack
'''
EXAMPLES = '''
- name: stop the virtual machine before resetting the password
local_action:
module: cs_instance
cs_instance:
name: myvirtualmachine
state: stopped
delegate_to: localhost
- name: reset and get new default password
local_action:
module: cs_instance_password_reset
cs_instance_password_reset:
vm: myvirtualmachine
register: root
delegate_to: localhost
- debug:
msg: "new default password is {{ root.password }}"
- name: boot the virtual machine to activate the new password
local_action:
module: cs_instance
cs_instance:
name: myvirtualmachine
state: started
delegate_to: localhost
when: root is changed
'''