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: description:
- Creates the account under the specified role name or id. - Creates the account under the specified role name or id.
type: str type: str
version_added: 2.8 version_added: '2.8'
ldap_domain: ldap_domain:
description: description:
- Name of the LDAP group or OU to bind. - Name of the LDAP group or OU to bind.
- If set, account will be linked to LDAP. - If set, account will be linked to LDAP.
type: str type: str
version_added: 2.8 version_added: '2.8'
ldap_type: ldap_type:
description: description:
- Type of the ldap name. GROUP or OU, defaults to GROUP. - Type of the ldap name. GROUP or OU, defaults to GROUP.
type: str type: str
choices: [ GROUP, OU ] choices: [ GROUP, OU ]
default: GROUP default: GROUP
version_added: 2.8 version_added: '2.8'
state: state:
description: description:
- State of the account. - State of the account.

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

View file

@ -17,123 +17,138 @@ short_description: Manages firewall rules on Apache CloudStack based clouds.
description: description:
- Creates and removes firewall rules. - Creates and removes firewall 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 ingress rule is assigned to. - Public IP address the ingress rule is assigned to.
- Required if C(type=ingress). - Required if I(type=ingress).
type: str
network: network:
description: description:
- Network the egress rule is related to. - Network the egress rule is related to.
- Required if C(type=egress). - Required if I(type=egress).
type: str
state: state:
description: description:
- State of the firewall rule. - State of the firewall rule.
type: str
default: present default: present
choices: [ present, absent ] choices: [ present, absent ]
type: type:
description: description:
- Type of the firewall rule. - Type of the firewall rule.
type: str
default: ingress default: ingress
choices: [ ingress, egress ] choices: [ ingress, egress ]
protocol: protocol:
description: description:
- Protocol of the firewall rule. - 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 default: tcp
choices: [ tcp, udp, icmp, all ] choices: [ tcp, udp, icmp, all ]
cidrs: cidrs:
description: description:
- List of CIDRs (full notation) to be used for firewall rule. - List of CIDRs (full notation) to be used for firewall rule.
- Since version 2.5, it is a list of CIDR. - Since version 2.5, it is a list of CIDR.
type: list
default: 0.0.0.0/0 default: 0.0.0.0/0
aliases: [ cidr ] aliases: [ cidr ]
start_port: start_port:
description: description:
- Start port for this rule. - 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 ] aliases: [ port ]
end_port: end_port:
description: description:
- End port for this rule. Considered if C(protocol=tcp) or C(protocol=udp). - End port for this rule. Considered if I(protocol=tcp) or I(protocol=udp).
- If not specified, equal C(start_port). - If not specified, equal I(start_port).
type: int
icmp_type: icmp_type:
description: description:
- Type of the icmp message being sent. - Type of the icmp message being sent.
- Considered if C(protocol=icmp). - Considered if I(protocol=icmp).
type: int
icmp_code: icmp_code:
description: description:
- Error code for this icmp message. - Error code for this icmp message.
- Considered if C(protocol=icmp). - Considered if I(protocol=icmp).
type: int
domain: domain:
description: description:
- Domain the firewall rule is related to. - Domain the firewall rule is related to.
type: str
account: account:
description: description:
- Account the firewall rule is related to. - Account the firewall rule is related to.
type: str
project: project:
description: description:
- Name of the project the firewall rule is related to. - Name of the project the firewall rule is related to.
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
type: bool type: bool
default: yes
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 an 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: Allow inbound port 80/tcp from 1.2.3.4 to 4.3.2.1 - name: Allow inbound port 80/tcp from 1.2.3.4 to 4.3.2.1
local_action: cs_firewall:
module: cs_firewall
ip_address: 4.3.2.1 ip_address: 4.3.2.1
port: 80 port: 80
cidr: 1.2.3.4/32 cidr: 1.2.3.4/32
delegate_to: localhost
- name: Allow inbound tcp/udp port 53 to 4.3.2.1 - name: Allow inbound tcp/udp port 53 to 4.3.2.1
local_action: cs_firewall:
module: cs_firewall
ip_address: 4.3.2.1 ip_address: 4.3.2.1
port: 53 port: 53
protocol: '{{ item }}' protocol: '{{ item }}'
with_items: with_items:
- tcp - tcp
- udp - udp
delegate_to: localhost
- name: Ensure firewall rule is removed - name: Ensure firewall rule is removed
local_action: cs_firewall:
module: cs_firewall
ip_address: 4.3.2.1 ip_address: 4.3.2.1
start_port: 8000 start_port: 8000
end_port: 8888 end_port: 8888
cidr: 17.0.0.0/8 cidr: 17.0.0.0/8
state: absent state: absent
delegate_to: localhost
- name: Allow all outbound traffic - name: Allow all outbound traffic
local_action: cs_firewall:
module: cs_firewall
network: my_network network: my_network
type: egress type: egress
protocol: all protocol: all
delegate_to: localhost
- name: Allow only HTTP outbound traffic for an IP - name: Allow only HTTP outbound traffic for an IP
local_action: cs_firewall:
module: cs_firewall
network: my_network network: my_network
type: egress type: egress
port: 80 port: 80
cidr: 10.101.1.20 cidr: 10.101.1.20
delegate_to: localhost
''' '''
RETURN = ''' RETURN = '''
@ -163,7 +178,7 @@ cidrs:
returned: success returned: success
type: list type: list
sample: [ '0.0.0.0/0' ] sample: [ '0.0.0.0/0' ]
version_added: "2.5" version_added: '2.5'
protocol: protocol:
description: Protocol of the rule. description: Protocol of the rule.
returned: success returned: success

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

View file

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

View file

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

View file

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

View file

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