NAT Gateway rule

nat_gateway_rule

This is a simple module that supports creating or removing NATGateway rules. This module has a dependency on ionoscloud >= 6.0.2

Example Syntax


name: Create NAT Gateway Rule
ionoscloudsdk.ionoscloud.nat_gateway_rule:
  datacenter: ''
  nat_gateway: ''
  name: 'AnsibleAutoTestNAT'
  type: SNAT
  protocol: TCP
  source_subnet: 10.0.1.0/24
  target_subnet: 10.0.1.0
  target_port_range:
    start: 10000
    end: 20000
  public_ip: ''
  wait: true
register: nat_gateway_rule_response


name: Update NAT Gateway Rule
ionoscloudsdk.ionoscloud.nat_gateway_rule:
  datacenter: ''
  nat_gateway: ''
  nat_gateway_rule: ''
  public_ip: ''
  name: 'AnsibleAutoTestNAT - UPDATED'
  type: SNAT
  protocol: TCP
  source_subnet: 10.0.1.0/24
  wait: true
  state: update
register: nat_gateway_rule_update_response


name: Delete NAT Gateway Rule
ionoscloudsdk.ionoscloud.nat_gateway_rule:
  datacenter: ''
  nat_gateway: ''
  nat_gateway_rule: ''
  state: absent

Returned object

{
    "changed": true,
    "failed": false,
    "action": "create",
    "nat_gateway_rule": {
        "href": "https://api.ionos.com/cloudapi/v6/datacenters/0406692b-b25f-4a58-8b41-e3b2d761447c/natgateways/abcc8593-a4a9-4ea0-b63c-04f95f395aa0/rules/42c85463-5b4f-485e-9e97-47dadc6d37ef",
        "id": "42c85463-5b4f-485e-9e97-47dadc6d37ef",
        "metadata": {
            "created_by": "<USER_EMAIL>",
            "created_by_user_id": "<USER_ID>",
            "created_date": "2023-05-31T11:53:14+00:00",
            "etag": "a0caa44599f8ef081cc93343a66c6738",
            "last_modified_by": "<USER_EMAIL>",
            "last_modified_by_user_id": "<USER_ID>",
            "last_modified_date": "2023-05-31T11:53:14+00:00",
            "state": "BUSY"
        },
        "properties": {
            "name": "AnsibleAutoTestNAT",
            "protocol": "TCP",
            "public_ip": "<IP1>",
            "source_subnet": "<SUBNET>",
            "target_port_range": {
                "end": 20000,
                "start": 10000
            },
            "target_subnet": "<SUBNET>",
            "type": "SNAT"
        },
        "type": "natgateway-rule"
    }
}

For more examples please check out the tests here.

state: present

  
name: Create NAT Gateway Rule
ionoscloudsdk.ionoscloud.nat_gateway_rule:
  datacenter: ''
  nat_gateway: ''
  name: 'AnsibleAutoTestNAT'
  type: SNAT
  protocol: TCP
  source_subnet: 10.0.1.0/24
  target_subnet: 10.0.1.0
  target_port_range:
    start: 10000
    end: 20000
  public_ip: ''
  wait: true
register: nat_gateway_rule_response

Available parameters for state present:

state: absent

  
name: Delete NAT Gateway Rule
ionoscloudsdk.ionoscloud.nat_gateway_rule:
  datacenter: ''
  nat_gateway: ''
  nat_gateway_rule: ''
  state: absent

Available parameters for state absent:

state: update

  
name: Update NAT Gateway Rule
ionoscloudsdk.ionoscloud.nat_gateway_rule:
  datacenter: ''
  nat_gateway: ''
  nat_gateway_rule: ''
  public_ip: ''
  name: 'AnsibleAutoTestNAT - UPDATED'
  type: SNAT
  protocol: TCP
  source_subnet: 10.0.1.0/24
  wait: true
  state: update
register: nat_gateway_rule_update_response

Available parameters for state update:

Last updated