29ee8f0e14
The removal of support for Centos-7 means that it is no longer necessary to maintain compatibility with LXC2 configuration keys. This patch removes the code which substitutes LXC3 keys for LXC2 keys. Depends-On: https://review.opendev.org/742166 Depends-On: https://review.opendev.org/742103 Change-Id: I2911a20a3391e880df80f41eed5c9a8d5e36c2f4
25 lines
1.1 KiB
Django/Jinja
25 lines
1.1 KiB
Django/Jinja
# {{ ansible_managed }}
|
|
{### For lxc > 3.0 use lxc.net.[i] otherwise use lxc.network #}
|
|
{% set _lxc_net_var = 'lxc.net.' + ((item.0 | default(0)) | string) %}
|
|
|
|
# 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) }}
|