Hello everyone!
I am using the
Later in the playbook, if the LXC has a secondary, public IP address assigned, I am adding it via shell execution of
I have tried to merge these two tasks into one by passing a dictionary with two entries to the
My question is: Does the API support this, i.e. provision the container with two interfaces with just one call? If so, how should I do it? I was trying to take the WebGUI as reference but, since you can only add one interface, I could not copy the format from there.
Thanks in advance.
I am using the
community.general.proxmox
Ansible module to provision LinuX Containers into my Proxmox 7 cluster. At the moment I am using this value for the netif
option:
YAML:
netif: {'net0':'name={{ proxmox_net_iface }},bridge={{ proxmox_net_bridge }},firewall=1,ip={{ ansible_host }}/{{ proxmox_net_mask }},mtu={{ proxmox_net_mtu }}
'}
Later in the playbook, if the LXC has a secondary, public IP address assigned, I am adding it via shell execution of
pvesh
:
YAML:
- name: Add a public IP address to the container
ansible.builtin.command:
cmd: "pvesh set /nodes/{{ proxmox_node }}/lxc/{{ proxmox_ctid }}/config --net1 'name=eth1,bridge=vmbr4001,firewall=1,ip={{ proxmox_public_ipv4_cidr }},gw={{ pro
xmox_public_ipv4_gw }},mtu={{ proxmox_public_net_mtu }}' --quiet"
when: proxmox_public_ipv4_cidr is defined
I have tried to merge these two tasks into one by passing a dictionary with two entries to the
netif
option of the first task:
Code:
{
'net0': 'name={{ proxmox_net_iface }},
bridge={{ proxmox_net_bridge }},
firewall=1,
ip={{ ansible_host }}/{{ proxmox_net_mask }},
mtu={{ proxmox_net_mtu }}',
'net1': 'name={{ proxmox_public_net_iface }},
bridge={{ proxmox_public_net_bridge }},
firewall=1,
ip={{ proxmox_public_ipv4_cidr }},
gw={{ proxmox_public_ipv4_gw }},
mtu={{ proxmox_public_net_mtu }}'
}
My question is: Does the API support this, i.e. provision the container with two interfaces with just one call? If so, how should I do it? I was trying to take the WebGUI as reference but, since you can only add one interface, I could not copy the format from there.
Thanks in advance.