ngine_io.cloudstack.cs_network – Manages networks on Apache CloudStack based clouds.

From Get docs
Ansible/docs/2.11/collections/ngine io/cloudstack/cs network module


ngine_io.cloudstack.cs_network – Manages networks on Apache CloudStack based clouds.

Note

This plugin is part of the ngine_io.cloudstack collection (version 2.0.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

  • account
  • domain

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

  • get

  • post

HTTP method used to query the API endpoint.

If not given, the CLOUDSTACK_METHOD env variable is considered.

api_key

string / required

API key of the CloudStack API.

If not given, the CLOUDSTACK_KEY env variable is considered.

api_secret

string / required

Secret key of the CloudStack API.

If not set, the CLOUDSTACK_SECRET env variable is considered.

api_timeout

integer

Default:

10

HTTP timeout in seconds.

If not given, the CLOUDSTACK_TIMEOUT env variable is considered.

api_url

string / required

URL of the CloudStack API e.g. https://cloud.example.com/client/api.

If not given, the CLOUDSTACK_ENDPOINT env variable is considered.

api_verify_ssl_cert

string

Verify CA authority cert file.

If not given, the CLOUDSTACK_VERIFY env variable is considered.

cidr_ipv6

string

CIDR of IPv6 network, must be at least /64.

Only considered on create.

clean_up

boolean

  • no

  • yes

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

  • no
  • yes

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

  • present

  • absent
  • restarted

State of the network.

subdomain_access

boolean

  • no
  • yes

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 / required

Name of the zone in which the network should be deployed.



Notes

Note

  • 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 network with start and end IP
  ngine_io.cloudstack.cs_network:
    name: Private Network
    network_offering: PrivNet
    start_ip: 10.12.9.10
    end_ip: 10.12.9.100
    netmask: 255.255.255.0
    zone: gva-01

- 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
    zone: zone01
    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
    zone: zone01
    clean_up: yes
    state: restarted

- name: Remove a network
  ngine_io.cloudstack.cs_network:
    name: my network
    zone: zone01
    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–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.11/collections/ngine_io/cloudstack/cs_network_module.html