New in version 2.0.
Create, update, restart and delete networks.
- python >= 2.6
- cs >= 0.6.10
parameter | required | default | choices | comments |
---|---|---|---|---|
account |
no | Account the network is related to. | ||
acl_type |
no | account |
|
Access control type. Only considered on create. |
api_http_method |
no | get |
|
HTTP method used. |
api_key |
no | API key of the CloudStack API. | ||
api_region |
no | cloudstack | Name of the ini section in the cloustack.ini file. | |
api_secret |
no | Secret key of the CloudStack API. | ||
api_timeout |
no | 10 | HTTP timeout. | |
api_url |
no | URL of the CloudStack API e.g. https://cloud.example.com/client/api. | ||
cidr_ipv6 |
no | CIDR of IPv6 network, must be at least /64. Only considered on create. | ||
clean_up |
no | Cleanup old network elements. Only considered on state=restarted . | ||
display_text |
no | Display text of the network. If not specified, name will be used as display_text . | ||
domain |
no | Domain the network is related to. | ||
end_ip |
no | The ending IPv4 address of the network belongs to. If not specified, value of start_ip is used.Only considered on create. | ||
end_ipv6 |
no | The ending IPv6 address of the network belongs to. If not specified, value of start_ipv6 is used.Only considered on create. | ||
gateway |
no | The gateway of the network. Required for shared networks and isolated networks when it belongs to VPC. Only considered on create. | ||
gateway_ipv6 |
no | The gateway of the IPv6 network. Required for shared networks. Only considered on create. | ||
isolated_pvlan |
no | The isolated private vlan for this network. | ||
name |
yes | Name (case sensitive) of the network. | ||
netmask |
no | The netmask of the network. Required for shared networks and isolated networks when it belongs to VPC. Only considered on create. | ||
network_domain |
no | The network domain. | ||
network_offering |
no | Name of the offering for the network. Required if state=present . | ||
poll_async |
no | True | Poll async jobs until job has finished. | |
project |
no | Name of the project the network to be deployed in. | ||
start_ip |
no | The beginning IPv4 address of the network belongs to. Only considered on create. | ||
start_ipv6 |
no | The beginning IPv6 address of the network belongs to. Only considered on create. | ||
state |
no | present |
|
State of the network. |
vlan |
no | The ID or VID of the network. | ||
vpc |
no | The ID or VID of the network. | ||
zone |
no | Name of the zone in which the network should be deployed. If not set, default zone is used. |
# create a network - local_action: module: cs_network name: my network zone: gva-01 network_offering: DefaultIsolatedNetworkOfferingWithSourceNatService network_domain: example.com # update a network - local_action: module: cs_network name: my network display_text: network of domain example.local network_domain: example.local # restart a network with clean up - local_action: module: cs_network name: my network clean_up: yes state: restared # remove a network - local_action: module: cs_network name: my network state: absent
Common return values are documented here Common Return Values, the following are the fields unique to this module:
name | description | returned | type | sample |
---|---|---|---|---|
domain | Domain the network is related to. | success | string | ROOT |
tags | List of resource tags associated with the network. | success | dict | [ { "key": "foo", "value": "bar" } ] |
is_persistent | Whether the network is persistent or not. | success | boolean | False |
netmask | IPv4 netmask. | success | string | 255.255.255.0 |
network_offering | The network offering name. | success | string | DefaultIsolatedNetworkOfferingWithSourceNatService |
broadcast_domain_type | Broadcast domain type of the network. | success | string | Vlan |
id | UUID of the network. | success | string | 04589590-ac63-4ffc-93f5-b698b8ac38b6 |
gateway_ipv6 | IPv6 gateway. | success | string | 2001:db8::1 |
display_text | Display text of the network. | success | string | web project |
account | Account the network is related to. | success | string | example account |
network_domain | The network domain | success | string | example.local |
name | Name of the network. | success | string | web project |
zone | Name of zone. | success | string | ch-gva-2 |
dns2 | IP address of the 2nd nameserver. | success | string | 1.2.3.4 |
dns1 | IP address of the 1st nameserver. | success | string | 1.2.3.4 |
cidr_ipv6 | IPv6 network CIDR. | success | string | 2001:db8::/64 |
project | Name of project. | success | string | Production |
state | State of the network (Allocated, Implemented, Setup). | success | string | Allocated |
gateway | IPv4 gateway. | success | string | 10.101.64.1 |
cidr | IPv4 network CIDR. | success | string | 10.101.64.0/24 |
traffic_type | Traffic type of the network. | success | string | Guest |
acl_type | Access type of the network (Domain, Account). | success | string | Account |
type | Type of the network. | success | string | Isolated |
Note
Ansible uses the cs
library’s configuration method if credentials are not provided by the arguments api_url
, api_key
, api_secret
. Configuration is read from several locations, in the following order. - The CLOUDSTACK_ENDPOINT
, CLOUDSTACK_KEY
, CLOUDSTACK_SECRET
and CLOUDSTACK_METHOD
. CLOUDSTACK_TIMEOUT
environment variables. - A CLOUDSTACK_CONFIG
environment variable pointing to an .ini
file, - A cloudstack.ini
file in the current working directory. - A .cloudstack.ini
file in the users home directory. Optionally multiple credentials and endpoints can be specified using ini sections in cloudstack.ini
. Use the argument api_region
to select the section name, default section is cloudstack
. See https://github.com/exoscale/cs for more information.
Note
This module supports check mode.
For more information on what this means please read Extras Modules
For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Helping Testing PRs and Developing Modules.