cloudscale_ch.cloud.subnet (2.3.1) — module

Manages subnets on the cloudscale.ch IaaS service

| "added in version" 1.3.0 of cloudscale_ch.cloud"

Authors: René Moser (@resmo)

Install collection

Install with ansible-galaxy collection install cloudscale_ch.cloud:==2.3.1


Add to requirements.yml

  collections:
    - name: cloudscale_ch.cloud
      version: 2.3.1

Description

Create, update and remove subnets.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
---
- name: Ensure subnet exists
  cloudscale_ch.cloud.subnet:
    cidr: 172.16.0.0/24
    network:
      uuid: 2db69ba3-1864-4608-853a-0771b6885a3a
    api_token: xxxxxx
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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

Inputs

    
cidr:
    description:
    - The cidr of the subnet.
    - Required if I(state=present).
    type: str

tags:
    description:
    - Tags associated with the subnet. Set this to C({}) to clear any tags.
    type: dict

uuid:
    description:
    - UUID of the subnet.
    type: str

reset:
    default: false
    description:
    - Resets I(gateway_address) and I(dns_servers) to default values by the API.
    - 'Note: Idempotency is not given.'
    type: bool

state:
    choices:
    - present
    - absent
    default: present
    description:
    - State of the subnet.
    type: str

api_url:
    default: https://api.cloudscale.ch/v1
    description:
    - cloudscale.ch API URL.
    - This can also be passed in the C(CLOUDSCALE_API_URL) environment variable.
    type: str
    version_added: 1.3.0
    version_added_collection: cloudscale_ch.cloud

network:
    description:
    - The name of the network the subnet is related to.
    - Required if I(state=present).
    suboptions:
      name:
        description:
        - The uuid of the network.
        type: str
      uuid:
        description:
        - The uuid of the network.
        type: str
      zone:
        description:
        - The zone the network allocated in.
        type: str
    type: dict

api_token:
    description:
    - cloudscale.ch API token.
    - This can also be passed in the C(CLOUDSCALE_API_TOKEN) environment variable.
    required: true
    type: str

api_timeout:
    default: 45
    description:
    - Timeout in seconds for calls to the cloudscale.ch API.
    - This can also be passed in the C(CLOUDSCALE_API_TIMEOUT) environment variable.
    type: int

dns_servers:
    description:
    - A list of DNS resolver IP addresses, that act as DNS servers.
    - If not set, the cloudscale.ch default resolvers are used.
    elements: str
    type: list

gateway_address:
    description:
    - 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.
    type: str

Outputs

cidr:
  description: The CIDR of the subnet.
  returned: success
  sample: 172.16.0.0/24
  type: str
dns_servers:
  description: List of DNS resolver IP addresses.
  returned: success
  sample:
  - 9.9.9.9
  - 149.112.112.112
  type: list
gateway_address:
  description: The gateway address of the subnet.
  returned: success
  sample: 192.168.42.1
  type: str
href:
  description: API URL to get details about the subnet.
  returned: success
  sample: https://api.cloudscale.ch/v1/subnets/33333333-1864-4608-853a-0771b6885a3
  type: str
network:
  contains:
    href:
      description: API URL to get details about the network.
      returned: success
      sample: https://api.cloudscale.ch/v1/networks/33333333-1864-4608-853a-0771b6885a3
      type: str
    name:
      description: The name of the network.
      returned: success
      sample: my network
      type: str
    uuid:
      description: The unique identifier for the network.
      returned: success
      sample: 33333333-1864-4608-853a-0771b6885a3
      type: str
    zone:
      description: The zone the network is allocated in.
      returned: success
      sample:
        slug: rma1
      type: dict
      version_added: 1.4.0
      version_added_collection: cloudscale_ch.cloud
  description: The network object of the subnet.
  returned: success
  type: complex
state:
  description: State of the subnet.
  returned: success
  sample: present
  type: str
tags:
  description: Tags associated with the subnet.
  returned: success
  sample:
    project: my project
  type: dict
uuid:
  description: The unique identifier for the subnet.
  returned: success
  sample: 33333333-1864-4608-853a-0771b6885a3
  type: str