community.general.proxmox_nic – Management of a NIC of a Qemu(KVM) VM in a Proxmox VE cluster.

Note

This plugin is part of the community.general collection (version 3.6.0).

To install it use: ansible-galaxy collection install community.general.

To use it in a playbook, specify: community.general.proxmox_nic.

New in version 3.1.0: of community.general

Synopsis

  • Allows you to create/update/delete a NIC on Qemu(KVM) Virtual Machines in a Proxmox VE cluster.

Requirements

The below requirements are needed on the host that executes this module.

  • proxmoxer

  • requests

Parameters

Parameter Choices/Defaults Comments
api_host
string / required
Specify the target host of the Proxmox VE cluster.
api_password
string
Specify the password to authenticate with.
You can use PROXMOX_PASSWORD environment variable.
api_token_id
string
added in 1.3.0 of community.general
Specify the token ID.
api_token_secret
string
added in 1.3.0 of community.general
Specify the token secret.
api_user
string / required
Specify the user to authenticate with.
bridge
string
Add this interface to the specified bridge device. The Proxmox VE default bridge is called vmbr0.
firewall
boolean
    Choices:
  • no ←
  • yes
Whether this interface should be protected by the firewall.
interface
string / required
Name of the interface, should be net[n] where 1 ≤ n ≤ 31.
link_down
boolean
    Choices:
  • no ←
  • yes
Whether this interface should be disconnected (like pulling the plug).
mac
string
XX:XX:XX:XX:XX:XX should be a unique MAC address. This is automatically generated if not specified.
When not specified this module will keep the MAC address the same when changing an existing interface.
model
string
    Choices:
  • e1000
  • e1000-82540em
  • e1000-82544gc
  • e1000-82545em
  • i82551
  • i82557b
  • i82559er
  • ne2k_isa
  • ne2k_pci
  • pcnet
  • rtl8139
  • virtio ←
  • vmxnet3
The NIC emulator model.
mtu
integer
Force MTU, for virtio model only, setting will be ignored otherwise.
Set to 1 to use the bridge MTU.
Value should be 1 ≤ n ≤ 65520.
name
string
Specifies the VM name. Only used on the configuration web interface.
Required only for state=present.
queues
integer
Number of packet queues to be used on the device.
Value should be 0 ≤ n ≤ 16.
rate
float
Rate limit in MBps (MegaBytes per second) as floating point number.
state
string
    Choices:
  • present ←
  • absent
Indicates desired state of the NIC.
tag
integer
VLAN tag to apply to packets on this interface.
Value should be 1 ≤ n ≤ 4094.
trunks
list / elements=integer
List of VLAN trunks to pass through this interface.
validate_certs
boolean
    Choices:
  • no ←
  • yes
If no, SSL certificates will not be validated.
This should only be used on personally controlled sites using self-signed certificates.
vmid
integer
Specifies the instance ID.

Examples

- name: Create NIC net0 targeting the vm by name
  community.general.proxmox_nic:
    api_user: [email protected]
    api_password: secret
    api_host: proxmoxhost
    name: my_vm
    interface: net0
    bridge: vmbr0
    tag: 3

- name: Create NIC net0 targeting the vm by id
  community.general.proxmox_nic:
    api_user: [email protected]
    api_password: secret
    api_host: proxmoxhost
    vmid: 103
    interface: net0
    bridge: vmbr0
    mac: "12:34:56:C0:FF:EE"
    firewall: true

- name: Delete NIC net0 targeting the vm by name
  community.general.proxmox_nic:
    api_user: [email protected]
    api_password: secret
    api_host: proxmoxhost
    name: my_vm
    interface: net0
    state: absent

Return Values

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

Key Returned Description
msg
string
always
A short message

Sample:
Nic net0 unchanged on VM with vmid 103
vmid
integer
success
The VM vmid.

Sample:
115


Authors