vmware.vmware_rest.appliance_networking_interfaces_ipv4 module – Manage the IPv4 configuration of a vCenter Server Appliance network interface.

Note

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

To use it in a playbook, specify: vmware.vmware_rest.appliance_networking_interfaces_ipv4.

New in vmware.vmware_rest 5.0.0

Synopsis

Parameters

Parameter

Comments

address

string

The IPv4 address to assign to the interface, for example 10.20.80.191.

Only relevant when mode=STATIC.

This property was added in vSphere API 6.7.

default_gateway

string

The IPv4 address of the default gateway for the appliance.

This sets the global default gateway using the specified gateway address and interface, replacing any existing default gateway. A link-local gateway address is added only for this interface. Configuring multiple global default gateways through different interfaces is not supported.

This property was added in vSphere API 6.7.

interface_name

string / required

The name of the network interface to configure, for example nic0.

The value is the identifier of an interface returned by vmware.vmware_rest.appliance_networking_interfaces_info.

mode

string

How the IPv4 address is assigned to the interface.

Use DHCP to have the address assigned automatically by a DHCP server.

Use STATIC to assign a fixed address, which requires address and prefix.

Use UNCONFIGURED to disable IPv4 on the interface.

This property was added in vSphere API 6.7.

prefix

integer

The IPv4 CIDR prefix length, for example 24 for a 255.255.255.0 netmask.

Only relevant when mode=STATIC.

This property was added in vSphere API 6.7.

session_timeout

float

Timeout in seconds for the whole operation including connection establishment, request sending, and response.

Default: 300.0

state

string

The desired state of the interface IPv4 configuration.

Use present to apply the given IPv4 settings.

Choices:

  • "present" ← (default)

vcenter_hostname

string / required

The hostname or IP address of the vSphere vCenter.

If the value is not specified in the task, the value of environment variable VMWARE_HOST will be used instead.

vcenter_password

string / required

The vSphere vCenter password.

If the value is not specified in the task, the value of environment variable VMWARE_PASSWORD will be used instead.

vcenter_port

integer

The port number of the vSphere vCenter.

If the value is not specified in the task, the value of environment variable VMWARE_PORT will be used instead.

vcenter_rest_log_file

string

Optional path to a log file for HTTP REST interaction.

If the value is not specified in the task, the value of environment variable VMWARE_REST_LOG_FILE will be used instead.

vcenter_username

string / required

The vSphere vCenter username.

If the value is not specified in the task, the value of environment variable VMWARE_USER will be used instead.

vcenter_validate_certs

boolean

Allows connection when SSL certificates are not valid.

Set to false when certificates are not trusted.

If the value is not specified in the task, the value of environment variable VMWARE_VALIDATE_CERTS will be used instead.

Choices:

  • false

  • true ← (default)

Notes

Note

  • Generated from vSphere API spec 9.1.0.

  • Compatible with vSphere API 7.0.3.

  • Compatible with vSphere API 8.0.2.

Examples

- name: Configure nic0 to obtain an IPv4 address via DHCP
  vmware.vmware_rest.appliance_networking_interfaces_ipv4:
    interface_name: nic0
    mode: DHCP
    state: present

- name: Assign a static IPv4 address to nic0
  vmware.vmware_rest.appliance_networking_interfaces_ipv4:
    interface_name: nic0
    mode: STATIC
    address: 10.20.80.191
    prefix: 24
    default_gateway: 10.20.80.1
    state: present

- name: Disable IPv4 on nic0
  vmware.vmware_rest.appliance_networking_interfaces_ipv4:
    interface_name: nic0
    mode: UNCONFIGURED
    state: present

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

value

any

The raw API response body from the vCenter operation. Empty when the operation returns no content.

Returned: On success

Sample: {}

Authors

  • Ansible Eco Content Team (@eco-ansible-content)