diff --git a/lib/ansible/modules/cloud/cloudstack/cs_snapshot_policy.py b/lib/ansible/modules/cloud/cloudstack/cs_snapshot_policy.py index d082f3b954..b9e65be7c6 100644 --- a/lib/ansible/modules/cloud/cloudstack/cs_snapshot_policy.py +++ b/lib/ansible/modules/cloud/cloudstack/cs_snapshot_policy.py @@ -19,115 +19,128 @@ short_description: Manages volume snapshot policies on Apache CloudStack based c description: - Create, update and delete volume snapshot policies. version_added: '2.2' -author: "René Moser (@resmo)" +author: René Moser (@resmo) options: volume: description: - Name of the volume. - - Either C(volume) or C(vm) is required. + - Either I(volume) or I(vm) is required. + type: str volume_type: description: - Type of the volume. + type: str choices: - DATADISK - ROOT - version_added: "2.3" + version_added: '2.3' vm: description: - Name of the instance to select the volume from. - - Use C(volume_type) if VM has a DATADISK and ROOT volume. - - In case of C(volume_type=DATADISK), additionally use C(device_id) if VM has more than one DATADISK volume. - - Either C(volume) or C(vm) is required. - version_added: "2.3" + - Use I(volume_type) if VM has a DATADISK and ROOT volume. + - In case of I(volume_type=DATADISK), additionally use I(device_id) if VM has more than one DATADISK volume. + - Either I(volume) or I(vm) is required. + type: str + version_added: '2.3' device_id: description: - ID of the device on a VM the volume is attached to. - This will only be considered if VM has multiple DATADISK volumes. - version_added: "2.3" + type: int + version_added: '2.3' vpc: description: - Name of the vpc the instance is deployed in. - version_added: "2.3" + type: str + version_added: '2.3' interval_type: description: - Interval of the snapshot. + type: str default: daily choices: [ hourly, daily, weekly, monthly ] aliases: [ interval ] max_snaps: description: - Max number of snapshots. + type: int default: 8 aliases: [ max ] schedule: description: - - Time the snapshot is scheduled. Required if C(state=present). - - 'Format for C(interval_type=HOURLY): C(MM)' - - 'Format for C(interval_type=DAILY): C(MM:HH)' - - 'Format for C(interval_type=WEEKLY): C(MM:HH:DD (1-7))' - - 'Format for C(interval_type=MONTHLY): C(MM:HH:DD (1-28))' + - Time the snapshot is scheduled. Required if I(state=present). + - 'Format for I(interval_type=HOURLY): C(MM)' + - 'Format for I(interval_type=DAILY): C(MM:HH)' + - 'Format for I(interval_type=WEEKLY): C(MM:HH:DD (1-7))' + - 'Format for I(interval_type=MONTHLY): C(MM:HH:DD (1-28))' + type: str time_zone: description: - Specifies a timezone for this command. + type: str default: UTC aliases: [ timezone ] state: description: - State of the snapshot policy. + type: str default: present choices: [ present, absent ] domain: description: - Domain the volume is related to. + type: str account: description: - Account the volume is related to. + type: str project: description: - Name of the project the volume is related to. + type: str extends_documentation_fragment: cloudstack ''' EXAMPLES = ''' - name: ensure a snapshot policy daily at 1h00 UTC - local_action: - module: cs_snapshot_policy + cs_snapshot_policy: volume: ROOT-478 schedule: '00:1' max_snaps: 3 + delegate_to: localhost - name: ensure a snapshot policy daily at 1h00 UTC on the second DATADISK of VM web-01 - local_action: - module: cs_snapshot_policy + cs_snapshot_policy: vm: web-01 volume_type: DATADISK device_id: 2 schedule: '00:1' max_snaps: 3 + delegate_to: localhost - name: ensure a snapshot policy hourly at minute 5 UTC - local_action: - module: cs_snapshot_policy + cs_snapshot_policy: volume: ROOT-478 schedule: '5' interval_type: hourly max_snaps: 1 + delegate_to: localhost - name: ensure a snapshot policy weekly on Sunday at 05h00, TZ Europe/Zurich - local_action: - module: cs_snapshot_policy + cs_snapshot_policy: volume: ROOT-478 schedule: '00:5:1' interval_type: weekly max_snaps: 1 time_zone: 'Europe/Zurich' + delegate_to: localhost - name: ensure a snapshot policy is absent - local_action: - module: cs_snapshot_policy + cs_snapshot_policy: volume: ROOT-478 interval_type: hourly state: absent + delegate_to: localhost ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/cloudstack/cs_sshkeypair.py b/lib/ansible/modules/cloud/cloudstack/cs_sshkeypair.py index 03d8b4d0ee..183dc57d8d 100644 --- a/lib/ansible/modules/cloud/cloudstack/cs_sshkeypair.py +++ b/lib/ansible/modules/cloud/cloudstack/cs_sshkeypair.py @@ -2,21 +2,7 @@ # -*- coding: utf-8 -*- # # (c) 2015, René Moser -# -# 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 . +# 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,49 +18,55 @@ description: - If no key was found and no public key was provided and a new SSH private/public key pair will be created and the private key will be returned. version_added: '2.0' -author: "René Moser (@resmo)" +author: René Moser (@resmo) options: name: description: - Name of public key. + type: str required: true domain: description: - Domain the public key is related to. + type: str account: description: - Account the public key is related to. + type: str project: description: - Name of the project the public key to be registered in. + type: str state: description: - State of the public key. - default: 'present' - choices: [ 'present', 'absent' ] + type: str + default: present + choices: [ present, absent ] public_key: description: - String of the public key. + type: str extends_documentation_fragment: cloudstack ''' EXAMPLES = ''' -# create a new private / public key pair: -- cs_sshkeypair: +- name: create a new private / public key pair + cs_sshkeypair: name: linus@example.com delegate_to: localhost register: key - debug: msg: 'Private key is {{ key.private_key }}' -# remove a public key by its name: -- cs_sshkeypair: +- name: remove a public key by its name + cs_sshkeypair: name: linus@example.com state: absent delegate_to: localhost -# register your existing local public key: -- cs_sshkeypair: +- name: register your existing local public key + cs_sshkeypair: name: linus@example.com public_key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}" delegate_to: localhost diff --git a/lib/ansible/modules/cloud/cloudstack/cs_staticnat.py b/lib/ansible/modules/cloud/cloudstack/cs_staticnat.py index dec3f8398a..8b9ff17484 100644 --- a/lib/ansible/modules/cloud/cloudstack/cs_staticnat.py +++ b/lib/ansible/modules/cloud/cloudstack/cs_staticnat.py @@ -15,46 +15,56 @@ module: cs_staticnat short_description: Manages static NATs on Apache CloudStack based clouds. description: - Create, update and remove static NATs. -version_added: "2.0" -author: "René Moser (@resmo)" +version_added: '2.0' +author: René Moser (@resmo) options: ip_address: description: - Public IP address the static NAT is assigned to. + type: str required: true vm: description: - Name of virtual machine which we make the static NAT for. - Required if I(state=present). + type: str vm_guest_ip: description: - VM guest NIC secondary IP address for the static NAT. + type: str network: description: - Network the IP address is related to. - version_added: "2.2" + type: str + version_added: '2.2' vpc: description: - VPC the network related to. - version_added: "2.3" + type: str + version_added: '2.3' state: description: - State of the static NAT. + type: str default: present choices: [ present, absent ] domain: description: - Domain the static NAT is related to. + type: str account: description: - Account the static NAT is related to. + type: str project: description: - Name of the project the static NAT 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. @@ -65,16 +75,16 @@ extends_documentation_fragment: cloudstack EXAMPLES = ''' - name: Create a static NAT for IP 1.2.3.4 to web01 - local_action: - module: cs_staticnat + cs_staticnat: ip_address: 1.2.3.4 vm: web01 + delegate_to: localhost - name: Remove a static NAT - local_action: - module: cs_staticnat + cs_staticnat: ip_address: 1.2.3.4 state: absent + delegate_to: localhost ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/cloudstack/cs_storage_pool.py b/lib/ansible/modules/cloud/cloudstack/cs_storage_pool.py index ff22fac994..2f770e8363 100644 --- a/lib/ansible/modules/cloud/cloudstack/cs_storage_pool.py +++ b/lib/ansible/modules/cloud/cloudstack/cs_storage_pool.py @@ -3,21 +3,7 @@ # # (c) 2017, Netservers Ltd. # (c) 2017, René Moser -# -# 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 . +# 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,33 +16,39 @@ module: cs_storage_pool short_description: Manages Primary Storage Pools on Apache CloudStack based clouds. description: - Create, update, put into maintenance, disable, enable and remove storage pools. -version_added: "2.4" +version_added: '2.4' author: - - "Netservers Ltd. (@netservers)" - - "René Moser (@resmo)" + - Netservers Ltd. (@netservers) + - René Moser (@resmo) options: name: description: - Name of the storage pool. + type: str required: true zone: description: - Name of the zone in which the host should be deployed. - If not set, default zone is used. + type: str storage_url: description: - URL of the storage pool. - - Required if C(state=present). + - Required if I(state=present). + type: str pod: description: - Name of the pod. + type: str cluster: description: - Name of the cluster. + type: str scope: description: - The scope of the storage pool. - Defaults to cluster when C(cluster) is provided, otherwise zone. + type: str choices: [ cluster, zone ] managed: description: @@ -66,27 +58,35 @@ options: hypervisor: description: - Required when creating a zone scoped pool. + type: str choices: [ KVM, VMware, BareMetal, XenServer, LXC, HyperV, UCS, OVM, Simulator ] storage_tags: description: - Tags associated with this storage pool. + type: list + aliases: [ storage_tag ] provider: description: - Name of the storage provider e.g. SolidFire, SolidFireShared, DefaultPrimary, CloudByte. + type: str default: DefaultPrimary capacity_bytes: description: - Bytes CloudStack can provision from this storage pool. + type: int capacity_iops: description: - Bytes CloudStack can provision from this storage pool. + type: int allocation_state: description: - Allocation state of the storage pool. + type: str choices: [ enabled, disabled, maintenance ] state: description: - State of the storage pool. + type: str default: present choices: [ present, absent ] extends_documentation_fragment: cloudstack @@ -94,18 +94,17 @@ extends_documentation_fragment: cloudstack EXAMPLES = ''' - name: ensure a zone scoped storage_pool is present - local_action: - module: cs_storage_pool + cs_storage_pool: zone: zone01 storage_url: rbd://admin:SECRET@ceph-mons.domain/poolname provider: DefaultPrimary name: Ceph RBD scope: zone hypervisor: KVM + delegate_to: localhost - name: ensure a cluster scoped storage_pool is disabled - local_action: - module: cs_storage_pool + cs_storage_pool: name: Ceph RBD zone: zone01 cluster: cluster01 @@ -114,10 +113,10 @@ EXAMPLES = ''' provider: DefaultPrimary scope: cluster allocation_state: disabled + delegate_to: localhost - name: ensure a cluster scoped storage_pool is in maintenance - local_action: - module: cs_storage_pool + cs_storage_pool: name: Ceph RBD zone: zone01 cluster: cluster01 @@ -126,12 +125,13 @@ EXAMPLES = ''' provider: DefaultPrimary scope: cluster allocation_state: maintenance + delegate_to: localhost - name: ensure a storage_pool is absent - local_action: - module: cs_storage_pool + cs_storage_pool: name: Ceph RBD state: absent + delegate_to: localhost ''' RETURN = ''' diff --git a/lib/ansible/modules/cloud/cloudstack/cs_template.py b/lib/ansible/modules/cloud/cloudstack/cs_template.py index 44a5c1b149..e0e48b79f8 100644 --- a/lib/ansible/modules/cloud/cloudstack/cs_template.py +++ b/lib/ansible/modules/cloud/cloudstack/cs_template.py @@ -18,33 +18,39 @@ description: - Create templates from a ROOT volume of a stopped VM or its snapshot. - Update (since version 2.7), extract and delete templates. version_added: '2.0' -author: "René Moser (@resmo)" +author: René Moser (@resmo) options: name: description: - Name of the template. + type: str required: true url: description: - URL of where the template is hosted on I(state=present). - URL to which the template would be extracted on I(state=extracted). - - Mutually exclusive with C(vm). + - Mutually exclusive with I(vm). + type: str vm: description: - VM name the template will be created from its volume or alternatively from a snapshot. - VM must be in stopped state if created from its volume. - - Mutually exclusive with C(url). + - Mutually exclusive with I(url). + type: str snapshot: description: - Name of the snapshot, created from the VM ROOT volume, the template will be created from. - - C(vm) is required together with this argument. + - I(vm) is required together with this argument. + type: str os_type: description: - OS type that best represents the OS of this template. + type: str checksum: description: - The MD5 checksum value of this template. - If set, we search by checksum instead of name. + type: str is_ready: description: - "Note: this flag was not implemented and therefore marked as deprecated." @@ -53,61 +59,69 @@ options: is_public: description: - Register the template to be publicly available to all users. - - Only used if C(state) is present. + - Only used if I(state) is C(present). type: bool is_featured: description: - Register the template to be featured. - - Only used if C(state) is present. + - Only used if I(state) is C(present). type: bool is_dynamically_scalable: description: - Register the template having XS/VMWare tools installed in order to support dynamic scaling of VM CPU/memory. - - Only used if C(state) is present. + - Only used if I(state) is C(present). type: bool cross_zones: description: - Whether the template should be synced or removed across zones. - - Only used if C(state) is present or absent. + - Only used if I(state) is C(present) or C(absent). default: no type: bool mode: description: - Mode for the template extraction. - Only used if I(state=extracted). + type: str default: http_download choices: [ http_download, ftp_upload ] domain: description: - Domain the template, snapshot or VM is related to. + type: str account: description: - Account the template, snapshot or VM is related to. + type: str project: description: - Name of the project the template to be registered in. + type: str zone: description: - Name of the zone you wish the template to be registered or deleted from. - If not specified, first found zone will be used. + type: str template_filter: description: - Name of the filter used to search for the template. - The filter C(all) was added in 2.7. + type: str default: self choices: [ all, featured, self, selfexecutable, sharedexecutable, executable, community ] template_find_options: description: - Options to find a template uniquely. - More than one allowed. + type: list choices: [ display_text, checksum, cross_zones ] - version_added: 2.7 + version_added: '2.7' aliases: [ template_find_option ] default: [] hypervisor: description: - Name the hypervisor to be used for creating the new template. - Relevant when using I(state=present). + type: str choices: - KVM - kvm @@ -139,20 +153,22 @@ options: template_tag: description: - The tag for this template. + type: str sshkey_enabled: description: - True if the template supports the sshkey upload feature. - - Only considered if C(url) is used (API limitation). + - Only considered if I(url) is used (API limitation). type: bool is_routing: description: - Sets the template type to routing, i.e. if template is used to deploy routers. - - Only considered if C(url) is used. + - Only considered if I(url) is used. type: bool format: description: - The format for the template. - Only considered if I(state=present). + type: str choices: [ QCOW2, RAW, VHD, OVA ] is_extractable: description: @@ -161,17 +177,21 @@ options: details: description: - Template details in key/value pairs. + type: str bits: description: - 32 or 64 bits support. + type: int default: 64 choices: [ 32, 64 ] display_text: description: - Display text of the template. + type: str state: description: - State of the template. + type: str default: present choices: [ present, absent, extracted ] poll_async: @@ -181,38 +201,38 @@ options: type: bool 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 a empty list e.g. I(tags: [])." + type: list aliases: [ tag ] - version_added: "2.4" + version_added: '2.4' extends_documentation_fragment: cloudstack ''' EXAMPLES = ''' - name: register a systemvm template - local_action: - module: cs_template + cs_template: name: systemvm-vmware-4.5 url: "http://packages.shapeblue.com/systemvmtemplate/4.5/systemvm64template-4.5-vmware.ova" hypervisor: VMware format: OVA cross_zones: yes os_type: Debian GNU/Linux 7(64-bit) + delegate_to: localhost - name: Create a template from a stopped virtual machine's volume - local_action: - module: cs_template + cs_template: name: Debian 9 (64-bit) 20GB ({{ ansible_date_time.date }}) vm: debian-9-base-vm os_type: Debian GNU/Linux 9 (64-bit) zone: tokio-ix password_enabled: yes is_public: yes + delegate_to: localhost # Note: Use template_find_option(s) when a template name is not unique - name: Create a template from a stopped virtual machine's volume - local_action: - module: cs_template + cs_template: name: Debian 9 (64-bit) display_text: Debian 9 (64-bit) 20GB ({{ ansible_date_time.date }}) template_find_option: display_text @@ -221,23 +241,24 @@ EXAMPLES = ''' zone: tokio-ix password_enabled: yes is_public: yes + delegate_to: localhost - name: create a template from a virtual machine's root volume snapshot - local_action: - module: cs_template + cs_template: name: Debian 9 (64-bit) Snapshot ROOT-233_2015061509114 snapshot: ROOT-233_2015061509114 os_type: Debian GNU/Linux 9 (64-bit) zone: tokio-ix password_enabled: yes is_public: yes + delegate_to: localhost - name: Remove a template - local_action: - module: cs_template + cs_template: name: systemvm-4.2 cross_zones: yes state: absent + delegate_to: localhost ''' RETURN = ''' @@ -350,7 +371,7 @@ url: tags: description: List of resource tags associated with the template. returned: if available - type: dict + type: list sample: '[ { "key": "foo", "value": "bar" } ]' zone: description: Name of zone the template is registered in. diff --git a/lib/ansible/modules/cloud/cloudstack/cs_volume.py b/lib/ansible/modules/cloud/cloudstack/cs_volume.py index 5a3d15a1a0..7d4a17a7c8 100644 --- a/lib/ansible/modules/cloud/cloudstack/cs_volume.py +++ b/lib/ansible/modules/cloud/cloudstack/cs_volume.py @@ -31,6 +31,11 @@ options: description: - Account the volume is related to. type: str + device_id: + description: + - ID of the device on a VM the volume is attached to. + - Only considered if I(state) is C(attached). + type: int custom_id: description: - Custom id to the resource. @@ -45,7 +50,6 @@ options: description: - Whether to display the volume to the end user or not. - Allowed to Root Admins only. - default: yes type: bool domain: description: diff --git a/lib/ansible/modules/cloud/cloudstack/cs_vpc.py b/lib/ansible/modules/cloud/cloudstack/cs_vpc.py index 54c06f8d32..9eccfdd5d5 100644 --- a/lib/ansible/modules/cloud/cloudstack/cs_vpc.py +++ b/lib/ansible/modules/cloud/cloudstack/cs_vpc.py @@ -17,42 +17,48 @@ DOCUMENTATION = ''' module: cs_vpc short_description: "Manages VPCs on Apache CloudStack based clouds." description: - - "Create, update and delete VPCs." -version_added: "2.3" -author: "René Moser (@resmo)" + - Create, update and delete VPCs. +version_added: '2.3' +author: René Moser (@resmo) options: name: description: - - "Name of the VPC." + - Name of the VPC. + type: str required: true display_text: description: - - "Display text of the VPC." - - "If not set, C(name) will be used for creating." + - Display text of the VPC. + - If not set, I(name) will be used for creating. + type: str cidr: description: - - "CIDR of the VPC, e.g. 10.1.0.0/16" - - "All VPC guest networks' CIDRs must be within this CIDR." - - "Required on I(state=present)." + - CIDR of the VPC, e.g. 10.1.0.0/16 + - All VPC guest networks' CIDRs must be within this CIDR. + - Required on I(state=present). + type: str network_domain: description: - - "Network domain for the VPC." - - "All networks inside the VPC will belong to this domain." - - "Only considered while creating the VPC, can not be changed." + - Network domain for the VPC. + - All networks inside the VPC will belong to this domain. + - Only considered while creating the VPC, can not be changed. + type: str vpc_offering: description: - - "Name of the VPC offering." - - "If not set, default VPC offering is used." + - Name of the VPC offering. + - If not set, default VPC offering is used. + type: str clean_up: description: - - "Whether to redeploy a VPC router or not when I(state=restarted)" - version_added: "2.5" + - Whether to redeploy a VPC router or not when I(state=restarted) + version_added: '2.5' type: bool state: description: - - "State of the VPC." - - "The state C(present) creates a started VPC." - - "The state C(stopped) is only considered while creating the VPC, added in version 2.6." + - State of the VPC. + - The state C(present) creates a started VPC. + - The state C(stopped) is only considered while creating the VPC, added in version 2.6. + type: str default: present choices: - present @@ -61,26 +67,30 @@ options: - restarted domain: description: - - "Domain the VPC is related to." + - Domain the VPC is related to. + type: str account: description: - - "Account the VPC is related to." + - Account the VPC is related to. + type: str project: description: - - "Name of the project the VPC is related to." + - Name of the project the VPC is related to. + type: str zone: description: - - "Name of the zone." - - "If not set, default zone is used." + - Name of the zone. + - If not set, default zone is used. + type: str tags: 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). - "For deleting all tags, set an empty list e.g. I(tags: [])." - aliases: - - tag + type: list + aliases: [ tag ] poll_async: description: - - "Poll async jobs until job has finished." + - Poll async jobs until job has finished. default: yes type: bool extends_documentation_fragment: cloudstack @@ -88,32 +98,32 @@ extends_documentation_fragment: cloudstack EXAMPLES = ''' - name: Ensure a VPC is present but not started after creating - local_action: - module: cs_vpc + cs_vpc: name: my_vpc display_text: My example VPC cidr: 10.10.0.0/16 state: stopped + delegate_to: localhost - name: Ensure a VPC is present and started after creating - local_action: - module: cs_vpc + cs_vpc: name: my_vpc display_text: My example VPC cidr: 10.10.0.0/16 + delegate_to: localhost - name: Ensure a VPC is absent - local_action: - module: cs_vpc + cs_vpc: name: my_vpc state: absent + delegate_to: localhost - name: Ensure a VPC is restarted with clean up - local_action: - module: cs_vpc + cs_vpc: name: my_vpc clean_up: yes state: restarted + delegate_to: localhost ''' RETURN = ''' @@ -191,7 +201,7 @@ state: tags: description: "List of resource tags associated with the VPC." returned: success - type: dict + type: list sample: '[ { "key": "foo", "value": "bar" } ]' ''' diff --git a/lib/ansible/modules/cloud/cloudstack/cs_vpc_offering.py b/lib/ansible/modules/cloud/cloudstack/cs_vpc_offering.py index dd83fed3c4..283401d4de 100644 --- a/lib/ansible/modules/cloud/cloudstack/cs_vpc_offering.py +++ b/lib/ansible/modules/cloud/cloudstack/cs_vpc_offering.py @@ -15,65 +15,66 @@ short_description: Manages vpc offerings on Apache CloudStack based clouds. description: - Create, update, enable, disable and remove CloudStack VPC offerings. version_added: '2.5' -author: "David Passante (@dpassante)" +author: David Passante (@dpassante) options: name: description: - The name of the vpc offering + type: str required: true state: description: - State of the vpc offering. + type: str choices: [ enabled, present, disabled, absent ] - required: false default: present display_text: description: - Display text of the vpc offerings - required: false + type: str service_capabilities: description: - Desired service capabilities as part of vpc offering. + type: list aliases: [ service_capability ] service_offering: description: - The name or ID of the service offering for the VPC router appliance. - required: false + type: str supported_services: description: - Services supported by the vpc offering + type: list aliases: [ supported_service ] - required: false service_providers: description: - provider to service mapping. If not specified, the provider for the service will be mapped to the default provider on the physical network + type: list aliases: [ service_provider ] - required: false poll_async: description: - Poll async jobs until job has finished. - default: true + default: yes type: bool extends_documentation_fragment: cloudstack ''' EXAMPLES = ''' -# Create a vpc offering and enable it -- local_action: - module: cs_vpc_offering - name: "my_vpc_offering" - display_text: "vpc offering description" +- name: Create a vpc offering and enable it + cs_vpc_offering: + name: my_vpc_offering + display_text: vpc offering description state: enabled supported_services: [ Dns, Dhcp ] service_providers: - {service: 'dns', provider: 'VpcVirtualRouter'} - {service: 'dhcp', provider: 'VpcVirtualRouter'} + delegate_to: localhost -# Create a vpc offering with redundant router -- local_action: - module: cs_vpc_offering - name: "my_vpc_offering" - display_text: "vpc offering description" +- name: Create a vpc offering with redundant router + cs_vpc_offering: + name: my_vpc_offering + display_text: vpc offering description supported_services: [ Dns, Dhcp, SourceNat ] service_providers: - {service: 'dns', provider: 'VpcVirtualRouter'} @@ -81,12 +82,12 @@ EXAMPLES = ''' - {service: 'SourceNat', provider: 'VpcVirtualRouter'} service_capabilities: - {service: 'SourceNat', capabilitytype: 'RedundantRouter', capabilityvalue: true} + delegate_to: localhost -# Create a region level vpc offering with distributed router -- local_action: - module: cs_vpc_offering - name: "my_vpc_offering" - display_text: "vpc offering description" +- name: Create a region level vpc offering with distributed router + cs_vpc_offering: + name: my_vpc_offering + display_text: vpc offering description state: present supported_services: [ Dns, Dhcp, SourceNat ] service_providers: @@ -96,12 +97,13 @@ EXAMPLES = ''' service_capabilities: - {service: 'Connectivity', capabilitytype: 'DistributedRouter', capabilityvalue: true} - {service: 'Connectivity', capabilitytype: 'RegionLevelVPC', capabilityvalue: true} + delegate_to: localhost -# Remove a vpc offering -- local_action: - module: cs_vpc_offering - name: "my_vpc_offering" +- name: Remove a vpc offering + cs_vpc_offering: + name: my_vpc_offering state: absent + delegate_to: localhost ''' RETURN = ''' diff --git a/test/sanity/validate-modules/ignore.txt b/test/sanity/validate-modules/ignore.txt index 2d4c8e6abb..bdc8d772e9 100644 --- a/test/sanity/validate-modules/ignore.txt +++ b/test/sanity/validate-modules/ignore.txt @@ -96,10 +96,7 @@ lib/ansible/modules/cloud/centurylink/clc_firewall_policy.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_host.py E326 -lib/ansible/modules/cloud/cloudstack/cs_storage_pool.py E322 lib/ansible/modules/cloud/cloudstack/cs_storage_pool.py E326 -lib/ansible/modules/cloud/cloudstack/cs_volume.py E322 -lib/ansible/modules/cloud/cloudstack/cs_volume.py E324 lib/ansible/modules/cloud/cloudstack/cs_vpn_connection.py E322 lib/ansible/modules/cloud/cloudstack/cs_zone.py E322 lib/ansible/modules/cloud/cloudstack/cs_zone.py E326