diff --git a/roles/proxmox_lxc_provision/README.md b/roles/proxmox_lxc_provision/README.md index ae4728d..194d91d 100755 --- a/roles/proxmox_lxc_provision/README.md +++ b/roles/proxmox_lxc_provision/README.md @@ -72,6 +72,9 @@ It also includes tasks which may be used individually: | `lxc_ipv6` | The IPv6 address | `auto` | | `lxc_gateway` | The default gateway | `10.0.0.1` | | `lxc_nameserver` | DNS nameserver | `10.0.0.7` | +| `lxc_bridge` | Linux bridge on the Proxmox host to attach the container to | `vmbr0` | +| `lxc_iface_name` | Interface name inside the container | `eth0` | +| `lxc_vlan_tag` | 802.1Q VLAN tag (integer 1-4094). Omitted from netif when unset. | - | | `lxc_pubkey_file` | Path to SSH public key file | `~/.ssh/id_ed25519.pub` | | `lxc_features` | List of container features | `["nesting=1"]` | | `lxc_tags` | Tags for the container | `["ansible-managed"]` | diff --git a/roles/proxmox_lxc_provision/defaults/main.yml b/roles/proxmox_lxc_provision/defaults/main.yml index e803cfd..43b697a 100755 --- a/roles/proxmox_lxc_provision/defaults/main.yml +++ b/roles/proxmox_lxc_provision/defaults/main.yml @@ -17,6 +17,9 @@ lxc_ipv4: dhcp lxc_ipv6: auto lxc_nameserver: 10.0.0.7 lxc_gateway: 10.0.0.1 +lxc_bridge: vmbr0 +lxc_iface_name: eth0 +# lxc_vlan_tag: unset by default; set to an integer (1-4094) to add an 802.1Q tag lxc_pubkey_file: "~/.ssh/id_ed25519.pub" lxc_unprivileged: true lxc_features: diff --git a/roles/proxmox_lxc_provision/tasks/create.yml b/roles/proxmox_lxc_provision/tasks/create.yml index d586085..10e3f3a 100755 --- a/roles/proxmox_lxc_provision/tasks/create.yml +++ b/roles/proxmox_lxc_provision/tasks/create.yml @@ -10,8 +10,8 @@ swap: "{{ lxc_swap }}" disk: "{{ lxc_disk }}" mounts: "{{ lxc_mounts | default(omit) }}" - netif: > - {"net0": "name=eth0,gw={{ lxc_gateway }},ip={{ lxc_ipv4 }},ip6={{ lxc_ipv6 | default(omit) }},bridge=vmbr0"} + netif: >- + {"net0": "name={{ lxc_iface_name }},bridge={{ lxc_bridge }},ip={{ lxc_ipv4 }},gw={{ lxc_gateway }},ip6={{ lxc_ipv6 }}{% if lxc_vlan_tag is defined %},tag={{ lxc_vlan_tag }}{% endif %}"} pubkey: "{{ lookup('file', lxc_pubkey_file) | default(omit) }}" onboot: "{{ lxc_onboot | default(false) }}" startup: "{{ lxc_startup | default(omit) }}" diff --git a/roles/proxmox_lxc_provision/tasks/update.yml b/roles/proxmox_lxc_provision/tasks/update.yml index f5aa2a8..d1dc360 100755 --- a/roles/proxmox_lxc_provision/tasks/update.yml +++ b/roles/proxmox_lxc_provision/tasks/update.yml @@ -8,7 +8,7 @@ memory: "{{ lxc_memory }}" swap: "{{ lxc_swap }}" disk: "{{ lxc_disk }}" - netif: '{"net0": "name=eth0,gw={{ lxc_gateway }},ip={{ lxc_ipv4 }},ip6={{ lxc_ipv6 | default(omit) }},bridge=vmbr0"}' + netif: '{"net0": "name={{ lxc_iface_name }},bridge={{ lxc_bridge }},ip={{ lxc_ipv4 }},gw={{ lxc_gateway }},ip6={{ lxc_ipv6 }}{% if lxc_vlan_tag is defined %},tag={{ lxc_vlan_tag }}{% endif %}"}' pubkey: "{{ lookup('file', lxc_pubkey_file) | default(omit) }}" onboot: "{{ lxc_onboot | default(false) }}" startup: "{{ lxc_startup | default(omit) }}"