IP Block

ipblock

This module allows you to create or remove an IPBlock.

Example Syntax


name: Create ipblock
ionoscloudsdk.ionoscloud.ipblock:
  name: 'AnsibleAutoTestCompute'
  location: 'gb/lhr'
  size: 2
  state: present
register: response


name: Remove ipblock
ionoscloudsdk.ionoscloud.ipblock:
  ipblock: 'AnsibleAutoTestCompute'
  state: absent
register: delete_result

Returned object

{
    "changed": true,
    "failed": false,
    "action": "create",
    "ipblock": {
        "href": "https://api.ionos.com/cloudapi/v6/ipblocks/0bce3fe3-67fd-4d7e-ba86-2e734ad2a79b",
        "id": "0bce3fe3-67fd-4d7e-ba86-2e734ad2a79b",
        "metadata": {
            "created_by": "<USER_EMAIL>",
            "created_by_user_id": "<USER_ID>",
            "created_date": "2023-05-29T11:45:10+00:00",
            "etag": "59558fb22d91e9d6d7a9750aba57fa47",
            "last_modified_by": "<USER_EMAIL>",
            "last_modified_by_user_id": "<USER_ID>",
            "last_modified_date": "2023-05-29T11:45:10+00:00",
            "state": "BUSY"
        },
        "properties": {
            "ip_consumers": [],
            "ips": [
                "<IP1>",
                "<IP2>"
            ],
            "location": "gb/lhr",
            "name": "AnsibleAutoTestCompute",
            "size": 2
        },
        "type": "ipblock"
    }
}

For more examples please check out the tests here.

NOTE: If you are using a versions 7.0.0 and up: modules can replace resources if certain set parameters differ from the results found in the API!

Parameters that can trigger a resource replacement:

  • size

  • location

state: present

  
name: Create ipblock
ionoscloudsdk.ionoscloud.ipblock:
  name: 'AnsibleAutoTestCompute'
  location: 'gb/lhr'
  size: 2
  state: present
register: response

Available parameters for state present:

NameRequiredDescription

name str

False

The name of the resource.

location str

True

Location of that IP block. Property cannot be modified after it is created (disallowed in update requests). Options: ['us/las', 'us/ewr', 'de/fra', 'de/fkb', 'de/txl', 'gb/lhr']

size int

False

The size of the IP block.

allow_replace bool

False

Boolean indicating if the resource should be recreated when the state cannot be reached in another way. This may be used to prevent resources from being deleted from specifying a different value to an immutable property. An error will be thrown instead Default: False

api_url str

False

The Ionos API base URL.

certificate_fingerprint str

False

The Ionos API certificate fingerprint.

username str

False

The Ionos username. Overrides the IONOS_USERNAME environment variable.

password str

False

The Ionos password. Overrides the IONOS_PASSWORD environment variable.

token str

False

The Ionos token. Overrides the IONOS_TOKEN environment variable.

wait bool

False

Wait for the resource to be created before returning. Default: True Options: [True, False]

wait_timeout int

False

How long before wait gives up, in seconds. Default: 600

state str

False

Indicate desired state of the resource. Default: present Options: ['present', 'absent']

state: absent

  
name: Remove ipblock
ionoscloudsdk.ionoscloud.ipblock:
  ipblock: 'AnsibleAutoTestCompute'
  state: absent
register: delete_result

Available parameters for state absent:

NameRequiredDescription

ipblock str

True

The name or ID of an existing IPBlock.

name str

False

The name of the resource.

api_url str

False

The Ionos API base URL.

certificate_fingerprint str

False

The Ionos API certificate fingerprint.

username str

False

The Ionos username. Overrides the IONOS_USERNAME environment variable.

password str

False

The Ionos password. Overrides the IONOS_PASSWORD environment variable.

token str

False

The Ionos token. Overrides the IONOS_TOKEN environment variable.

wait bool

False

Wait for the resource to be created before returning. Default: True Options: [True, False]

wait_timeout int

False

How long before wait gives up, in seconds. Default: 600

state str

False

Indicate desired state of the resource. Default: present Options: ['present', 'absent']

Last updated