network/salt/lxc-containers-1/config

41 lines
1.1 KiB
Plaintext
Raw Normal View History

2016-11-03 00:26:30 +01:00
lxc.utsname = {{ id }}
# Handled by lxc@.service
lxc.start.auto = 0
lxc.rootfs = /var/lib/lxc/{{ id }}/rootfs
lxc.rootfs.backend = dir
lxc.autodev = 1
lxc.kmsg = 0
2016-11-06 23:16:44 +01:00
{%- for net, conf in container['interfaces'].items() %}
lxc.network.type={{ conf['type'] }}
2016-11-03 00:26:30 +01:00
lxc.network.flags=up
2016-11-08 22:36:08 +01:00
{%- if conf['type'] == 'veth' %}
2016-11-06 02:49:56 +01:00
lxc.network.veth.pair={{ id }}-{{ net }}
{%- endif %}
2016-11-09 01:18:00 +01:00
{%- set hosts = pillar['hosts-inet'].get(net) %}
{%- set inet_addr = hosts and hosts.get(id) %}
2016-11-06 02:49:56 +01:00
{%- if inet_addr %}
{%- set prefix_len = pillar['subnets-inet'][net].split('/')[1] %}
lxc.network.ipv4={{ inet_addr }}/{{ prefix_len }}
{%- endif %}
2016-11-06 23:16:44 +01:00
{%- if conf['type'] == 'veth' %}
2016-11-06 02:49:56 +01:00
lxc.network.link=br-{{ net }}
2016-11-08 22:36:08 +01:00
{%- elif conf['type'] == 'phys' %}
lxc.network.link=bond0.{{ pillar['vlans'].get(net) }}
2016-11-06 02:49:56 +01:00
{%- endif %}
lxc.network.name={{ net }}
2016-11-09 01:18:00 +01:00
{%- set gw = conf.get('gw') %}
{%- if gw %}
lxc.network.ipv4.gateway={{ pillar['hosts-inet'][net][gw] }}
2016-11-08 22:36:08 +01:00
{%- endif %}
2016-11-03 00:26:30 +01:00
#lxc.network.ipv6=
#lxc.network.ipv6.gateway=fe80::1
2016-11-06 02:49:56 +01:00
{%- endfor %}
2016-11-03 00:26:30 +01:00
## TODO: limits + caps
2016-11-15 01:33:17 +01:00
## TODO: include Debian.common.conf
# tuntap
lxc.cgroup.devices.allow = c 10:200 rw