community.general.proxmox_nic (8.5.0) — module

Management of a NIC of a Qemu(KVM) VM in a Proxmox VE cluster

| "added in version" 3.1.0 of community.general"

Authors: Lammert Hellinga (@Kogelvis) <lammert@hellinga.it>

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

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


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create NIC net0 targeting the vm by name
  community.general.proxmox_nic:
    api_user: root@pam
    api_password: secret
    api_host: proxmoxhost
    name: my_vm
    interface: net0
    bridge: vmbr0
    tag: 3
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create NIC net0 targeting the vm by id
  community.general.proxmox_nic:
    api_user: root@pam
    api_password: secret
    api_host: proxmoxhost
    vmid: 103
    interface: net0
    bridge: vmbr0
    mac: "12:34:56:C0:FF:EE"
    firewall: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete NIC net0 targeting the vm by name
  community.general.proxmox_nic:
    api_user: root@pam
    api_password: secret
    api_host: proxmoxhost
    name: my_vm
    interface: net0
    state: absent

Inputs

    
mac:
    description:
    - V(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.
    type: str

mtu:
    description:
    - Force MTU, for C(virtio) model only, setting will be ignored otherwise.
    - Set to V(1) to use the bridge MTU.
    - "Value should be C(1 \u2264 n \u2264 65520)."
    type: int

tag:
    description:
    - VLAN tag to apply to packets on this interface.
    - "Value should be C(1 \u2264 n \u2264 4094)."
    type: int

name:
    description:
    - Specifies the VM name. Only used on the configuration web interface.
    - Required only for O(state=present).
    type: str

rate:
    description:
    - Rate limit in MBps (MegaBytes per second) as floating point number.
    type: float

vmid:
    description:
    - Specifies the instance ID.
    type: int

model:
    choices:
    - e1000
    - e1000-82540em
    - e1000-82544gc
    - e1000-82545em
    - i82551
    - i82557b
    - i82559er
    - ne2k_isa
    - ne2k_pci
    - pcnet
    - rtl8139
    - virtio
    - vmxnet3
    default: virtio
    description:
    - The NIC emulator model.
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Indicates desired state of the NIC.
    type: str

bridge:
    description:
    - Add this interface to the specified bridge device. The Proxmox VE default bridge
      is called V(vmbr0).
    type: str

queues:
    description:
    - Number of packet queues to be used on the device.
    - "Value should be C(0 \u2264 n \u2264 16)."
    type: int

trunks:
    description:
    - List of VLAN trunks to pass through this interface.
    elements: int
    type: list

api_host:
    description:
    - Specify the target host of the Proxmox VE cluster.
    required: true
    type: str

api_user:
    description:
    - Specify the user to authenticate with.
    required: true
    type: str

firewall:
    default: false
    description:
    - Whether this interface should be protected by the firewall.
    type: bool

interface:
    description:
    - "Name of the interface, should be V(net[n]) where C(1 \u2264 n \u2264 31)."
    required: true
    type: str

link_down:
    default: false
    description:
    - Whether this interface should be disconnected (like pulling the plug).
    type: bool

api_password:
    description:
    - Specify the password to authenticate with.
    - You can use E(PROXMOX_PASSWORD) environment variable.
    type: str

api_token_id:
    description:
    - Specify the token ID.
    - Requires C(proxmoxer>=1.1.0) to work.
    type: str
    version_added: 1.3.0
    version_added_collection: community.general

validate_certs:
    default: false
    description:
    - If V(false), SSL certificates will not be validated.
    - This should only be used on personally controlled sites using self-signed certificates.
    type: bool

api_token_secret:
    description:
    - Specify the token secret.
    - Requires C(proxmoxer>=1.1.0) to work.
    type: str
    version_added: 1.3.0
    version_added_collection: community.general

Outputs

msg:
  description: A short message
  returned: always
  sample: Nic net0 unchanged on VM with vmid 103
  type: str
vmid:
  description: The VM vmid.
  returned: success
  sample: 115
  type: int