openstack-ansible-lxc_conta.../templates/debian-interface.cfg.j2
Logan V eeabfbc042 Enhance configurability of LXC net interfaces
Add the ability to append pre-up, post-up, pre-down, and post-down script
entries to the container_networks dict that are dropped along with the OSA
default configurations when templating the container's interface config files.

The keys preup, postup, predown, and postdown will be appended to the OSA
lxc_container_default_{pre,post}{up/down} lists when dropping the interface
config.

Change-Id: Idf15ec17bac03b55638fb8d862e5445093677f23
2017-03-22 11:48:04 -05:00

34 lines
1.2 KiB
Django/Jinja

# {{ ansible_managed }}
### start generated network for [ {{ item.value.interface }} ] ###
auto {{ item.value.interface }}
{% if item.value.address is defined %}
iface {{ item.value.interface }} inet static
address {{ item.value.address }}
netmask {{ item.value.netmask }}
{% if item.value.gateway is defined %}
gateway {{ item.value.gateway }}
{% endif %}
mtu {{ item.value.mtu|default(lxc_container_default_mtu) }}
{% if item.value.static_routes is defined %}
{% for route in item.value.static_routes %}
post-up ip route add {{ route['cidr'] }} via {{ route['gateway'] }} || true
{% endfor %}
{% endif %}
{% else %}
iface {{ item.value.interface }} inet manual
{% endif %}
{% for item in item.value.preup | default([]) | union(lxc_container_default_preup) %}
pre-up {{ item }}
{% endfor %}
{% for item in item.value.postup | default([]) | union(lxc_container_default_postup) %}
post-up {{ item }}
{% endfor %}
{% for item in item.value.predown | default([]) | union(lxc_container_default_predown) %}
pre-down {{ item }}
{% endfor %}
{% for item in item.value.postdown | default([]) | union(lxc_container_default_postdown) %}
post-down {{ item }}
{% endfor %}
### end generated network for [ {{ item.value.interface }} ] ###