On this page
ngine_io.cloudstack.cs_network – Manages networks on Apache CloudStack based clouds.
Note
This plugin is part of the ngine_io.cloudstack collection (version 1.1.0).
To install it use: ansible-galaxy collection install ngine_io.cloudstack
.
To use it in a playbook, specify: ngine_io.cloudstack.cs_network
.
New in version 0.1.0: of ngine_io.cloudstack
Synopsis
- Create, update, restart and delete networks.
Requirements
The below requirements are needed on the host that executes this module.
- python >= 2.6
- cs >= 0.9.0
Parameters
Parameter | Choices/Defaults | Comments |
---|---|---|
account
string
|
Account the network is related to.
|
|
acl
string
|
The name of the access control list for the VPC network tier.
|
|
acl_type
string
|
|
Access control type for the network.
If not specified, Cloudstack will default to
account for isolated networks
and
domain for shared networks.
Only considered on create.
|
api_http_method
string
|
|
HTTP method used to query the API endpoint.
If not given, the
CLOUDSTACK_METHOD env variable is considered.
As the last option, the value is taken from the ini config file, also see the notes.
Fallback value is get if not specified.
|
api_key
string
|
API key of the CloudStack API.
If not given, the
CLOUDSTACK_KEY env variable is considered.
As the last option, the value is taken from the ini config file, also see the notes.
|
|
api_region
string
|
Default:
"cloudstack"
|
Name of the ini section in the
cloustack.ini file.
If not given, the CLOUDSTACK_REGION env variable is considered.
|
api_secret
string
|
Secret key of the CloudStack API.
If not set, the
CLOUDSTACK_SECRET env variable is considered.
As the last option, the value is taken from the ini config file, also see the notes.
|
|
api_timeout
integer
|
HTTP timeout in seconds.
If not given, the
CLOUDSTACK_TIMEOUT env variable is considered.
As the last option, the value is taken from the ini config file, also see the notes.
Fallback value is 10 seconds if not specified.
|
|
api_url
string
|
URL of the CloudStack API e.g. https://cloud.example.com/client/api.
If not given, the
CLOUDSTACK_ENDPOINT env variable is considered.
As the last option, the value is taken from the ini config file, also see the notes.
|
|
api_verify_ssl_cert
string
|
CA authority cert file.
If not given, the
CLOUDSTACK_VERIFY env variable is considered.
As the last option, the value is taken from the ini config file, also see the notes.
Fallback value is null if not specified.
|
|
cidr_ipv6
string
|
CIDR of IPv6 network, must be at least /64.
Only considered on create.
|
|
clean_up
boolean
|
|
Cleanup old network elements.
Only considered on state=restarted.
|
display_text
string
|
Display text of the network.
If not specified, name will be used as display_text.
|
|
domain
string
|
Domain the network is related to.
|
|
end_ip
string
|
The ending IPv4 address of the network belongs to.
If not specified, value of start_ip is used.
Only considered on create.
|
|
end_ipv6
string
|
The ending IPv6 address of the network belongs to.
If not specified, value of start_ipv6 is used.
Only considered on create.
|
|
gateway
string
|
The gateway of the network.
Required for shared networks and isolated networks when it belongs to a VPC.
Only considered on create.
|
|
gateway_ipv6
string
|
The gateway of the IPv6 network.
Required for shared networks.
Only considered on create.
|
|
isolated_pvlan
string
|
The isolated private VLAN for this network.
|
|
name
string / required
|
Name (case sensitive) of the network.
|
|
netmask
string
|
The netmask of the network.
Required for shared networks and isolated networks when it belongs to a VPC.
Only considered on create.
|
|
network_domain
string
|
The network domain.
|
|
network_offering
string
|
Name of the offering for the network.
Required if state=present.
|
|
poll_async
boolean
|
|
Poll async jobs until job has finished.
|
project
string
|
Name of the project the network to be deployed in.
|
|
start_ip
string
|
The beginning IPv4 address of the network belongs to.
Only considered on create.
|
|
start_ipv6
string
|
The beginning IPv6 address of the network belongs to.
Only considered on create.
|
|
state
string
|
|
State of the network.
|
subdomain_access
boolean
|
|
Defines whether to allow subdomains to use networks dedicated to their parent domain(s).
Should be used with acl_type=domain.
Only considered on create.
|
tags
list / elements=dictionary
|
List of tags. Tags are a list of dictionaries having keys key and value.
To delete all tags, set a empty list e.g. tags: [].
aliases: tag |
|
vlan
string
|
The ID or VID of the network.
|
|
vpc
string
|
Name of the VPC of the network.
|
|
zone
string
|
Name of the zone in which the network should be deployed.
If not set, default zone is used.
|
Notes
Note
- Ansible uses the
cs
library’s configuration method if credentials are not provided by the argumentsapi_url
,api_key
,api_secret
. Configuration is read from several locations, in the following order. TheCLOUDSTACK_ENDPOINT
,CLOUDSTACK_KEY
,CLOUDSTACK_SECRET
andCLOUDSTACK_METHOD
.CLOUDSTACK_TIMEOUT
environment variables. ACLOUDSTACK_CONFIG
environment variable pointing to an.ini
file. Acloudstack.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 incloudstack.ini
. Use the argumentapi_region
to select the section name, default section iscloudstack
. See https://github.com/exoscale/cs for more information. - A detailed guide about cloudstack modules can be found in the CloudStack Cloud Guide.
- This module supports check mode.
Examples
- name: Create a network
ngine_io.cloudstack.cs_network:
name: my network
zone: gva-01
network_offering: DefaultIsolatedNetworkOfferingWithSourceNatService
network_domain: example.com
- name: Create a VPC tier
ngine_io.cloudstack.cs_network:
name: my VPC tier 1
zone: gva-01
vpc: my VPC
network_offering: DefaultIsolatedNetworkOfferingForVpcNetworks
gateway: 10.43.0.1
netmask: 255.255.255.0
acl: my web acl
- name: Update a network
ngine_io.cloudstack.cs_network:
name: my network
display_text: network of domain example.local
network_domain: example.local
- name: Restart a network with clean up
ngine_io.cloudstack.cs_network:
name: my network
clean_up: yes
state: restarted
- name: Remove a network
ngine_io.cloudstack.cs_network:
name: my network
state: absent
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key | Returned | Description |
---|---|---|
account
string
|
success |
Account the network is related to.
Sample:
example account
|
acl
string
|
success |
Name of the access control list for the VPC network tier.
Sample:
My ACL
|
acl_id
string
|
success |
ID of the access control list for the VPC network tier.
Sample:
dfafcd55-0510-4b8c-b6c5-b8cedb4cfd88
|
acl_type
string
|
success |
Access type of the network (Domain, Account).
Sample:
Account
|
broadcast_domain_type
string
|
success |
Broadcast domain type of the network.
Sample:
Vlan
|
cidr
string
|
success |
IPv4 network CIDR.
Sample:
10.101.64.0/24
|
cidr_ipv6
string
|
if available |
IPv6 network CIDR.
Sample:
2001:db8::/64
|
display_text
string
|
success |
Display text of the network.
Sample:
web project
|
dns1
string
|
success |
IP address of the 1st nameserver.
Sample:
1.2.3.4
|
dns2
string
|
success |
IP address of the 2nd nameserver.
Sample:
1.2.3.4
|
domain
string
|
success |
Domain the network is related to.
Sample:
ROOT
|
gateway
string
|
success |
IPv4 gateway.
Sample:
10.101.64.1
|
gateway_ipv6
string
|
if available |
IPv6 gateway.
Sample:
2001:db8::1
|
id
string
|
success |
UUID of the network.
Sample:
04589590-ac63-4ffc-93f5-b698b8ac38b6
|
is_persistent
boolean
|
success |
Whether the network is persistent or not.
|
is_system
boolean
|
success |
Whether the network is system related or not.
|
name
string
|
success |
Name of the network.
Sample:
web project
|
netmask
string
|
success |
IPv4 netmask.
Sample:
255.255.255.0
|
network_domain
string
|
success |
The network domain
Sample:
example.local
|
network_offering
string
|
success |
The network offering name.
Sample:
DefaultIsolatedNetworkOfferingWithSourceNatService
|
network_offering_availability
string
|
success |
The availability of the network offering the network is created from
Sample:
Optional
|
network_offering_conserve_mode
boolean
|
success |
Whether the network offering has IP conserve mode enabled or not.
|
network_offering_display_text
string
|
success |
The network offering display text.
Sample:
Offering for Isolated Vpc networks with Source Nat service enabled
|
project
string
|
success |
Name of project.
Sample:
Production
|
state
string
|
success |
State of the network (Allocated, Implemented, Setup).
Sample:
Allocated
|
tags
list / elements=string
|
success |
List of resource tags associated with the network.
Sample:
[ { "key": "foo", "value": "bar" } ]
|
traffic_type
string
|
success |
Traffic type of the network.
Sample:
Guest
|
type
string
|
success |
Type of the network.
Sample:
Isolated
|
vpc
string
|
if available |
Name of the VPC.
Sample:
My VPC
|
zone
string
|
success |
Name of zone.
Sample:
ch-gva-2
|
Authors
- René Moser (@resmo)
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/ngine_io/cloudstack/cs_network_module.html