cs_physical_network – Manages physical networks on Apache CloudStack based clouds

New in version 2.8.

Synopsis

  • Create, update and remove networks.
  • Enabled and disabled Network Service Providers
  • Enables Internal LoadBalancer and VPC/VirtualRouter elements as required

Requirements

The below requirements are needed on the host that executes this module.

  • python >= 2.6
  • cs >= 0.6.10

Parameters

Parameter Choices/Defaults Comments
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.
broadcast_domain_range
string
    Choices:
  • POD
  • ZONE
broadcast domain range for the physical network[Pod or Zone].
domain
string
Domain the network is owned by.
isolation_method
string
    Choices:
  • VLAN
  • GRE
  • L3
Isolation method for the physical network.
name
string / required
Name of the physical network.

aliases: physical_network
network_speed
string
    Choices:
  • 1G
  • 10G
The speed for the physical network.
nsps_disabled
list
List of Network Service Providers to disable.
nsps_enabled
list
List of Network Service Providers to enable.
poll_async
boolean
    Choices:
  • no
  • yes ←
Poll async jobs until job has finished.
state
string
    Choices:
  • present ←
  • absent
  • disabled
  • enabled
State of the physical network.
tags
string
A tag to identify this network.
Physical networks support only one tag.
To remove an existing tag pass an empty string.

aliases: tag
vlan
string
The VLAN/VNI Ranges of the physical network.
zone
string
Name of the zone in which the network belongs.
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: Ensure a network is present
  cs_physical_network:
    name: net01
    zone: zone01
    isolation_method: VLAN
    broadcast_domain_range: ZONE
  delegate_to: localhost

- name: Set a tag on a network
  cs_physical_network:
    name: net01
    tag: overlay
  delegate_to: localhost

- name: Remove tag on a network
  cs_physical_network:
    name: net01
    tag: ""
  delegate_to: localhost

- name: Ensure a network is enabled with specific nsps enabled
  cs_physical_network:
    name: net01
    zone: zone01
    isolation_method: VLAN
    vlan: 100-200,300-400
    broadcast_domain_range: ZONE
    state: enabled
    nsps_enabled:
      - virtualrouter
      - internallbvm
      - vpcvirtualrouter
  delegate_to: localhost

- name: Ensure a network is disabled
  cs_physical_network:
    name: net01
    zone: zone01
    state: disabled
  delegate_to: localhost

- name: Ensure a network is enabled
  cs_physical_network:
    name: net01
    zone: zone01
    state: enabled
  delegate_to: localhost

- name: Ensure a network is absent
  cs_physical_network:
    name: net01
    zone: zone01
    state: absent
  delegate_to: localhost

Return Values

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

Key Returned Description
broadcast_domain_range
string
success
broadcastdomainrange of the network [POD / ZONE].

Sample:
ZONE
domain
string
success
Name of domain the network is in.

Sample:
domain1
id
string
success
UUID of the network.

Sample:
3f8f25cd-c498-443f-9058-438cfbcbff50
isolation_method
string
success
isolationmethod of the network [VLAN/GRE/L3].

Sample:
VLAN
name
string
success
Name of the network.

Sample:
net01
network_speed
string
success
networkspeed of the network [1G/10G].

Sample:
1G
nsps
complex
on enabling/disabling of Network Service Providers
list of enabled or disabled Network Service Providers

 
disabled
list
on Network Service Provider disabling
list of Network Service Providers that were disabled

Sample:
['internallbvm']
 
enabled
list
on Network Service Provider enabling
list of Network Service Providers that were enabled

Sample:
['virtualrouter']
state
string
success
State of the network [Enabled/Disabled].

Sample:
Enabled
zone
string
success
Name of zone the physical network is in.

Sample:
ch-gva-2


Status

Authors

  • Netservers Ltd. (@netservers)
  • Patryk Cichy (@PatTheSilent)

Hint

If you notice any issues in this documentation, you can edit this document to improve it.