cloudscale_ch.cloud.subnet – Manages subnets on the cloudscale.ch IaaS service

From Get docs
Ansible/docs/2.10/collections/cloudscale ch/cloud/subnet module


cloudscale_ch.cloud.subnet – Manages subnets on the cloudscale.ch IaaS service

Note

This plugin is part of the cloudscale_ch.cloud collection (version 1.3.0).

To install it use: ansible-galaxy collection install cloudscale_ch.cloud.

To use it in a playbook, specify: cloudscale_ch.cloud.subnet.


New in version 1.3.0: of cloudscale_ch.cloud


Synopsis

  • Create, update and remove subnets.

Parameters

Parameter Choices/Defaults Comments

api_timeout

integer

Default:

30

Timeout in seconds for calls to the cloudscale.ch API.

api_token

string / required

cloudscale.ch API token.

This can also be passed in the CLOUDSCALE_API_TOKEN environment variable.

api_url

string

added in 1.3.0 of cloudscale_ch.cloud

Default:

cloudscale.ch API URL.

This can also be passed in the CLOUDSCALE_API_URL environment variable.

cidr

string

The cidr of the subnet.

Required if state=present.

dns_servers

list / elements=string

A list of DNS resolver IP addresses, that act as DNS servers.

If not set, the cloudscale.ch default resolvers are used.

gateway_address

string

The gateway address of the subnet. If not set, no gateway is used.

Cannot be within the DHCP range, which is the lowest .101-.254 in the subnet.

network

dictionary

The name of the network the subnet is related to.

Required if state=present.

name

string

The uuid of the network.

uuid

string

The uuid of the network.

zone

string

The zone the network allocated in.

reset

boolean

  • no

  • yes

Resets gateway_address and dns_servers to default values by the API.

Note: Idempotency is not given.

state

string

  • present

  • absent

State of the subnet.

tags

dictionary

Tags associated with the subnet. Set this to {} to clear any tags.

uuid

string

UUID of the subnet.



Notes

Note


Examples

---
- name: Ensure subnet exists
  cloudscale_ch.cloud.subnet:
    cidr: 172.16.0.0/24
    network:
      uuid: 2db69ba3-1864-4608-853a-0771b6885a3a
    api_token: xxxxxx

- name: Ensure subnet exists
  cloudscale_ch.cloud.subnet:
    cidr: 192.168.1.0/24
    gateway_address: 192.168.1.1
    dns_servers:
      - 192.168.1.10
      - 192.168.1.11
    network:
      name: private
      zone: lpg1
    api_token: xxxxxx

- name: Ensure a subnet is absent
  cloudscale_ch.cloud.subnet:
    cidr: 172.16.0.0/24
    network:
      name: private
      zone: lpg1
    state: absent
    api_token: xxxxxx

Return Values

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

Key Returned Description

cidr

string

success

The CIDR of the subnet.


Sample:

172.16.0.0/24

dns_servers

list / elements=string

success

List of DNS resolver IP addresses.


Sample:

['9.9.9.9', '149.112.112.112']

gateway_address

string

success

The gateway address of the subnet.


Sample:

192.168.42.1

href

string

success

API URL to get details about the subnet.


Sample:

network

complex

success

The network object of the subnet.


href

string

success

API URL to get details about the network.


Sample:

name

string

success

The name of the network.


Sample:

my network

uuid

string

success

The unique identifier for the network.


Sample:

33333333-1864-4608-853a-0771b6885a3

state

string

success

State of the subnet.


Sample:

present

tags

dictionary

success

Tags associated with the subnet.


Sample:

{'project': 'my project'}

uuid

string

success

The unique identifier for the subnet.


Sample:

33333333-1864-4608-853a-0771b6885a3




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/cloudscale_ch/cloud/subnet_module.html