openstack-ansible-lxc_hosts/templates/lxc-net-bridge.cfg.j2
Jimmy McCrory 158d035b92 Make corrections to LXC bridge template file
This change adjusts a few of the modifications made to the
lxc-net-bridge.cfg.j2 template file in change
I3c8225124a5f18db81259e1d52d0168ef52c3c17.

The minus signs have been removed from if and endif blocks so that
whitespace is kept intact between sections. The ordering of post-up and
post-down commands has also been changed so that iptables rules are
created before the dnsmasq service is started, as they were previously.

The default value of lxc_net_gateway has also been changed to null so
that it's evaluated as expected. Its current value, none, is evaluated
as a string.

A test has been added to compare the contents of the deployed lxc bridge
interface file with its expected contents.

Change-Id: I39d7b3f40de6ac691550c11d71bb6a182b3452f4
2016-03-05 11:41:31 -08:00

26 lines
770 B
Django/Jinja

# {{ ansible_managed }}
auto {{ lxc_net_bridge }}
iface {{ lxc_net_bridge }} inet static
address {{ lxc_net_address }}
netmask {{ lxc_net_netmask }}
{% if lxc_net_gateway is not none %}
gateway {{ lxc_net_gateway }}
{% endif %}
{% if lxc_net_mtu is defined %}
mtu {{ lxc_net_mtu }}
{% endif %}
{% if lxc_net_nat | bool %}
# dnsmasq start and stop
post-up /usr/local/bin/lxc-system-manage iptables-create
post-up /usr/local/bin/lxc-system-manage dnsmasq-start || true
post-down /usr/local/bin/lxc-system-manage iptables-remove
post-down /usr/local/bin/lxc-system-manage dnsmasq-stop
{% endif %}
bridge_fd 0
bridge_maxwait 0
bridge_ports {{ lxc_net_bridge_port }}
bridge_hello 2
bridge_maxage 12
bridge_stp off