ngine_io.cloudstack.cs_vlan_ip_range – Manages VLAN IP ranges on Apache CloudStack based clouds.

Note

This plugin is part of the ngine_io.cloudstack collection (version 1.2.0).

To install it use: ansible-galaxy collection install ngine_io.cloudstack.

To use it in a playbook, specify: ngine_io.cloudstack.cs_vlan_ip_range.

New in version 0.1.0: of ngine_io.cloudstack

Synopsis

  • Create and delete VLAN IP range.

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 who owns the VLAN.
Mutually exclusive with project.
api_http_method
string
    Choices:
  • get
  • post
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
The CIDR of IPv6 network, must be at least /64.
domain
string
Domain of the account owning the VLAN.
end_ip
string
The ending IPv4 address in the VLAN IP range.
If not specified, value of start_ip is used.
Only considered on create.
end_ipv6
string
The ending IPv6 address in the IPv6 network range.
If not specified, value of start_ipv6 is used.
Only considered on create.
for_system_vms
boolean
    Choices:
  • no ←
  • yes
yes if IP range is set to system vms, no if not
for_virtual_network
boolean
added in 1.0.0 of ngine_io.cloudstack
    Choices:
  • no ←
  • yes
yes if VLAN is of Virtual type, no if Direct.
If set to yes but neither physical_network or network is set CloudStack will try to add the VLAN range to the Physical Network with a Public traffic type.
gateway
string
The gateway of the VLAN IP range.
Required if state=present.
gateway_ipv6
string
The gateway of the IPv6 network.
Only considered on create.
netmask
string
The netmask of the VLAN IP range.
Required if state=present.
network
string
The network name or id.
Required if for_virtual_network and physical_network are not set.
physical_network
string
The physical network name or id.
pod
string
added in 1.0.0 of ngine_io.cloudstack
Name of the pod.
project
string
Project who owns the VLAN.
Mutually exclusive with account.
start_ip
string / required
The beginning IPv4 address in the VLAN IP range.
Only considered on create.
start_ipv6
string
The beginning IPv6 address in the IPv6 network range.
Only considered on create.
state
string
    Choices:
  • present ←
  • absent
State of the network ip range.
vlan
string
The ID or VID of the network.
If not specified, will be defaulted to the vlan of the network.
zone
string
The Zone ID of the VLAN IP range.
If not set, default zone is used.

Notes

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.

  • A detailed guide about cloudstack modules can be found in the CloudStack Cloud Guide.

  • This module supports check mode.

Examples

- name: create a VLAN IP range for network test
  ngine_io.cloudstack.cs_vlan_ip_range:
    network: test
    vlan: 98
    start_ip: 10.2.4.10
    end_ip: 10.2.4.100
    gateway: 10.2.4.1
    netmask: 255.255.255.0
    zone: zone-02

- name: remove a VLAN IP range for network test
  ngine_io.cloudstack.cs_vlan_ip_range:
    state: absent
    network: test
    start_ip: 10.2.4.10
    end_ip: 10.2.4.100
    zone: zone-02

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
account
string
if available
Account who owns the network.

Sample:
example account
cidr_ipv6
string
if available
The CIDR of IPv6 network.

Sample:
2001:db8::/64
domain
string
success
Domain name of the VLAN IP range.

Sample:
ROOT
end_ip
string
success
The end ip of the VLAN IP range.

Sample:
10.2.4.100
end_ipv6
string
if available
The end ipv6 of the VLAN IP range.

Sample:
2001:db8::50
for_systemvms
boolean
success
Whether VLAN IP range is dedicated to system vms or not.

for_virtual_network
boolean
success
Whether VLAN IP range is of Virtual type or not.

gateway
string
success
IPv4 gateway.

Sample:
10.2.4.1
gateway_ipv6
string
if available
IPv6 gateway.

Sample:
2001:db8::1
id
string
success
UUID of the VLAN IP range.

Sample:
04589590-ac63-4ffc-93f5-b698b8ac38b6
netmask
string
success
IPv4 netmask.

Sample:
255.255.255.0
network
string
if available
The network of vlan range

Sample:
test
physical_network
string
success
The physical network VLAN IP range belongs to.

Sample:
04589590-ac63-4ffc-93f5-b698b8ac38b6
project
string
if available
Project who owns the network.

Sample:
example project
start_ip
string
success
The start ip of the VLAN IP range.

Sample:
10.2.4.10
start_ipv6
string
if available
The start ipv6 of the VLAN IP range.

Sample:
2001:db8::10
vlan
string
success
The ID or VID of the VLAN.

Sample:
vlan://98
zone
string
success
Name of zone.

Sample:
zone-02


Authors

  • David Passante (@dpassante)