community.vmware.vca_nat module – add remove nat rules in a gateway in a vca

Note

This module is part of the community.vmware collection (version 2.5.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 community.vmware.

To use it in a playbook, specify: community.vmware.vca_nat.

DEPRECATED

Removed in

major release after 2022-06-01

Why

Module depends upon deprecated version of Pyvcloud library.

Alternative

Use https://github.com/vmware/ansible-module-vcloud-director instead.

Synopsis

  • Adds or removes nat rules from a gateway in a vca environment

Parameters

Parameter

Comments

api_version

string

The API version to be used with the vca.

Default: “5.7”

gateway_name

string

The name of the gateway of the vdc where the rule should be added.

Default: “gateway”

host

string

The authentication host to be used when service type is vcd.

instance_id

string

The instance ID in a vchs environment to be used for creating the vapp.

nat_rules

string / required

A list of rules to be added to the gateway, Please see examples on valid entries

Default: “no”

org

string

The org to login to for creating vapp.

This option is required when the service_type is vdc.

password

aliases: pass, passwd

string

The vca password, if not set the environment variable VCA_PASS is checked for the password.

purge_rules

boolean

If set to true, it will delete all rules in the gateway that are not given as parameter to this module.

Choices:

  • no ← (default)

  • yes

service_type

string

The type of service we are authenticating against.

Choices:

  • vca ← (default)

  • vcd

  • vchs

state

string

Whether the object should be added or removed.

Choices:

  • absent

  • present ← (default)

username

aliases: user

string

The vca username or email address, if not set the environment variable VCA_USER is checked for the username.

validate_certs

aliases: verify_certs

boolean

If the certificates of the authentication is to be verified.

Choices:

  • no

  • yes ← (default)

vdc_name

string

The name of the vdc where the gateway is located.

Examples

#An example for a source nat

- hosts: localhost
  connection: local
  tasks:
   - community.vmware.vca_nat:
       instance_id: 'b15ff1e5-1024-4f55-889f-ea0209726282'
       vdc_name: 'benz_ansible'
       state: 'present'
       nat_rules:
         - rule_type: SNAT
           original_ip: 192.0.2.42
           translated_ip: 203.0.113.23

#example for a DNAT
- hosts: localhost
  connection: local
  tasks:
   - community.vmware.vca_nat:
       instance_id: 'b15ff1e5-1024-4f55-889f-ea0209726282'
       vdc_name: 'benz_ansible'
       state: 'present'
       nat_rules:
         - rule_type: DNAT
           original_ip: 203.0.113.23
           original_port: 22
           translated_ip: 192.0.2.42
           translated_port: 22

Status

  • This module will be removed in a major release after 2022-06-01. [deprecated]

  • For more information see DEPRECATED.

Authors

  • Peter Sprygada (@privateip)