# {{ ansible_managed }} {### For lxc > 3.0 use lxc.net.[i] otherwise use lxc.network #} {% set _lxc_net_var = (lxc_three_syntax | bool) | ternary ('lxc.net.' + ((item.0 | default(0)) | string),'lxc.network') %} # Set the interface's type for the container {{ _lxc_net_var }}.type = {{ item.1.type|default('veth') }} # Network device within the container {{ _lxc_net_var }}.name = {{ item.1.interface }} {% if item.1.type is not defined or item.1.type == 'veth' %} # Name the veth after the container # NOTE(major): The lxc.network.veth.pair line must appear right after # lxc.network.name or it will be ignored. {{ _lxc_net_var }}.veth.pair = {{ lxc_container_network_veth_pair_indexed[-15:] }} {% endif %} # Host link to attach to, this should be a bridge if lxc.network.type = veth {{ _lxc_net_var }}.link = {{ item.1.bridge }} {% if item.1.type is not defined or item.1.type != 'phys' %} # Hardware Address {{ _lxc_net_var }}.hwaddr = {{ hostvars[inventory_hostname][item.1.interface + '_mac_address'] }} {% endif %} # enable the device on boot {{ _lxc_net_var }}.flags = up # Set the container network MTU {{ _lxc_net_var }}.mtu = {{ item.1.mtu|default(lxc_container_default_mtu) }}