On this page
cloudscale_ch.cloud.network – Manages networks on the cloudscale.ch IaaS service
Note
This plugin is part of the cloudscale_ch.cloud collection (version 2.2.0).
You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install cloudscale_ch.cloud.
To use it in a playbook, specify: cloudscale_ch.cloud.network.
New in version 1.2.0: of cloudscale_ch.cloud
Synopsis
- Create, update and remove networks.
 
Parameters
| Parameter | Choices/Defaults | Comments | 
|---|---|---|
| api_timeout
        
        integer
         | 
      Default: 
        45
         | 
      
        
        Timeout in seconds for calls to the cloudscale.ch API.
        
       
        This can also be passed in the  CLOUDSCALE_API_TIMEOUT environment variable.
        | 
     
| 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: 
        "https://api.cloudscale.ch/v1"
         | 
      
        
        cloudscale.ch API URL.
        
       
        This can also be passed in the  CLOUDSCALE_API_URL environment variable.
        | 
     
| auto_create_ipv4_subnet
        
        boolean
         | 
      
       
  | 
      
        
        Whether to automatically create an IPv4 subnet in the network or not.
         | 
     
| mtu
        
        integer
         | 
      Default: 
        9000
         | 
      
        
        The MTU of the network.
         | 
     
| name
        
        string
         | 
      
        
        Name of the network.
        
       
        Either name or uuid is required.
         | 
     |
| state
        
        string
         | 
      
       
  | 
      
        
        State of the network.
         | 
     
| tags
        
        dictionary
         | 
      
        
        Tags assosiated with the networks. Set this to  {} to clear any tags.
        | 
     |
| uuid
        
        string
         | 
      
        
        UUID of the network.
        
       
        Either name or uuid is required.
         | 
     |
| zone
        
        string
         | 
      
        
        Zone slug of the network (e.g.  lgp1 or rma1).
        | 
     
Notes
Note
- All operations are performed using the cloudscale.ch public API v1.
 - For details consult the full API documentation: https://www.cloudscale.ch/en/api/v1.
 - A valid API token is required for all operations. You can create as many tokens as you like using the cloudscale.ch control panel at https://control.cloudscale.ch.
 
Examples
---
- name: Ensure network exists
  cloudscale_ch.cloud.network:
    name: my network
    api_token: xxxxxx
- name: Ensure network in a specific zone
  cloudscale_ch.cloud.network:
    name: my network
    zone: lpg1
    api_token: xxxxxx
- name: Ensure a network is absent
  cloudscale_ch.cloud.network:
    name: my network
    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 | |
|---|---|---|---|
| created_at
        
        string
         | 
      success | 
        
        The creation date and time of the network.
         Sample:
        
       
        2019-05-29T13:18:42.511407Z
         | 
     |
| href
        
        string
         | 
      success | 
        
        API URL to get details about this network.
         Sample:
        
       
        https://api.cloudscale.ch/v1/networks/cfde831a-4e87-4a75-960f-89b0148aa2cc
         | 
     |
| mtu
        
        integer
         | 
      success | 
        
        The MTU of the network.
         Sample:
        
       
        9000
         | 
     |
| name
        
        string
         | 
      success | 
        
        The name of the network.
         Sample:
        
       
        my network
         | 
     |
| state
        
        string
         | 
      success | 
        
        State of the network.
         Sample:
        
       
        present
         | 
     |
| subnets
        
        complex
         | 
      success | 
        
        A list of subnets objects of the network.
          | 
     |
| cidr
        
        string
         | 
      success | 
        
        The CIDR of the subnet.
         Sample:
        
       
        172.16.0.0/24
         | 
     |
| href
        
        string
         | 
      success | 
        
        API URL to get details about the subnet.
         Sample:
        
       
        https://api.cloudscale.ch/v1/subnets/33333333-1864-4608-853a-0771b6885a3
         | 
     |
| uuid
        
        string
         | 
      success | 
        
        The unique identifier for the subnet.
         Sample:
        
       
        33333333-1864-4608-853a-0771b6885a3
         | 
     |
| tags
        
        dictionary
         | 
      success | 
        
        Tags assosiated with the network.
         Sample:
        
       
        {'project': 'my project'}
         | 
     |
| uuid
        
        string
         | 
      success | 
        
        The unique identifier for the network.
         Sample:
        
       
        cfde831a-4e87-4a75-960f-89b0148aa2cc
         | 
     |
| zone
        
        dictionary
         | 
      success | 
        
        The zone of the network.
         Sample:
        
       
        {'slug': 'rma1'}
         | 
     |
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/latest/collections/cloudscale_ch/cloud/network_module.html