Skip to content

Commit e9e4131

Browse files
authored
Merge pull request #49 from damfle/ipv6
Basic routes and IPv6 support
2 parents 9aa5874 + 25e580c commit e9e4131

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,18 @@ should be a dict containing the following items:
4444
name (optional).
4545
- `dhcp_start` First IP of the DHCP range in `route` or `nat` mode (optional).
4646
- `dhcp_end` Last IP of the DHCP range in `route` or `nat` mode (optional).
47+
- `routes` Optional list of additionals routes defined as following:
48+
- `address` Address of the route, required.
49+
- `prefix` Prefix of the route, required.
50+
- `gateway` Gateway of the route, required.
51+
- `metric` Metric of the route (optional).
52+
- `ipv6` IPv6 address of the virtual bridge (optional).
53+
- `ipv6_prefix` IPv6 prefix of the virtual bridge (optional).
54+
- `routesv6` Optional list of additionals IPv6 routes defined as following:
55+
- `address` IPv6 address of the route, required.
56+
- `prefix` IPv6 previx of the route, required.
57+
- `gateway` gateway of the route, required.
58+
- `metric` metric of the route (optional).
4759

4860
`libvirt_host_require_vt` is whether to require that Intel Virtualisation
4961
Technology (VT) is enabled in order to run this role. While this provides

templates/network.xml.j2

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
<network connections='1'>
1+
<network {% if item.ipv6 is defined %}ipv6='yes'{% endif %} connections='1'>
22
<name>{{ item.name }}</name>
33
<forward mode='{{ item.mode }}'/>
44
<bridge name='{{ item.bridge }}'/>
5-
{% if item.mode == 'route' or item.mode == 'nat' %}
5+
{% if item.mode == 'route' or item.mode == 'nat' %}
66
<domain name='{{ item.domain|default(item.name) }}'/>
77
<ip address='{{ item.ip }}' netmask='{{ item.netmask }}'>
88
{% if item.dhcp_start is defined and item.dhcp_end is defined %}
@@ -11,5 +11,19 @@
1111
</dhcp>
1212
{% endif %}
1313
</ip>
14+
{% if item.routes is defined %}
15+
{% for route in item.routes %}
16+
<route address="{{ route.address }}" prefix="{{ route.prefix }}" gateway="{{ route.gateway }}" {% if route.metric is defined %} metric='{{ route.metric }}' {% endif %}/>
17+
{% endfor %}
1418
{% endif %}
19+
{% if item.ipv6 is defined and item.ipv6_prefix is defined %}
20+
<ip family='ipv6' address='{{ item.ipv6 }}' prefix='{{ item.ipv6_prefix }}'>
21+
</ip>
22+
{% endif %}
23+
{% if item.routesv6 is defined %}
24+
{% for route in item.routesv6 %}
25+
<route family="ipv6" address="{{ route.address }}" prefix="{{ route.prefix }}" gateway="{{ route.gateway }}" {% if route.metric is defined %} metric='{{ route.metric }}' {% endif %}/>
26+
{% endfor %}
27+
{% endif %}
28+
{% endif %}
1529
</network>

0 commit comments

Comments
 (0)