4f09e886c2
The bridge (vmbr0) and interface name (eth0) were previously hardcoded in the netif string, and there was no way to set an 802.1Q VLAN tag. Expose lxc_bridge, lxc_iface_name, and lxc_vlan_tag (optional) so containers can be attached to non-default bridges or tagged into a VLAN without forking the role. Also drop the misleading 'lxc_ipv6 | default(omit)' filter — default(omit) does not produce omission inside a string context, and lxc_ipv6 always has a default of 'auto' in defaults/main.yml.
25 lines
1.0 KiB
YAML
Executable File
25 lines
1.0 KiB
YAML
Executable File
---
|
|
- name: Create an LXC container
|
|
community.proxmox.proxmox:
|
|
vmid: "{{ lxc_vmid | default(omit) }}"
|
|
hostname: "{{ lxc_hostname }}"
|
|
password: "{{ lxc_root_password | default(omit) }}"
|
|
ostemplate: "{{ lxc_template }}"
|
|
cores: "{{ lxc_cores }}"
|
|
memory: "{{ lxc_memory }}"
|
|
swap: "{{ lxc_swap }}"
|
|
disk: "{{ lxc_disk }}"
|
|
mounts: "{{ lxc_mounts | default(omit) }}"
|
|
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) }}"
|
|
unprivileged: "{{ lxc_unprivileged | default(true) }}"
|
|
features: "{{ lxc_features | default(omit) }}"
|
|
timezone: "{{ lxc_timezone | default(omit) }}"
|
|
nameserver: "{{ lxc_nameserver | default(omit) }}"
|
|
state: present
|
|
tags: "{{ lxc_tags | default(omit) }}"
|
|
register: lxc_result
|