Browse Source

Add documentation for routed interfaces

Using the container_(extra)_networks hash a user can define a routed
interface for a network without an address. This change documents that
capability.

Change-Id: I93bdfde1aa5a9820d1853a779caf6670ee58d335
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
Kevin Carter 8 months ago
parent
commit
7ba42bc3d7
2 changed files with 10 additions and 1 deletions
  1. 9
    0
      defaults/main.yml
  2. 1
    1
      tasks/nspawn_networking.yml

+ 9
- 0
defaults/main.yml View File

@@ -33,6 +33,8 @@ nspawn_networks:
33 33
     netmask: 255.255.255.0
34 34
     # Optional | Set the macvlan mode
35 35
     macvlan_mode: bridge
36
+    # Optional | set the routed interface
37
+    routed_interface: mv-nspawn0
36 38
 
37 39
 # Primary interface used for host to container communications. In the event that
38 40
 # the underlying system is running a condensed network stack a route will be
@@ -57,6 +59,7 @@ nspawn_networks:
57 59
 # + simple example:
58 60
 #   management_cidr: "172.29.236.0/24"
59 61
 #   storage_cidr: "10.0.0.0/24"
62
+#   flat_cidr: "172.29.239.0/24"
60 63
 #   container_networks:
61 64
 #     management_address:
62 65
 #       bridge: eth0
@@ -66,6 +69,10 @@ nspawn_networks:
66 69
 #       netmask: 255.255.255.0
67 70
 #     tunnel_address:
68 71
 #       bridge: eth0.10
72
+#     flat_address:
73
+#       bridge: eth0
74
+#       interface: mv-flat
75
+#       routed_interface: mv-flat
69 76
 #
70 77
 # Extra interfaces that are wholly configured by the user can be set using the
71 78
 # container extra networks option. This option follows all of the parameters of
@@ -80,6 +87,8 @@ container_extra_networks: {}
80 87
 #    assigned to the underlying interface, "eth0".
81 88
 #  + The tunnel network will be attached to the container and isolated from the
82 89
 #    host with no access to without first attaching to the container.
90
+#  + The flat network will be created and attached to the container with a host
91
+#    route on the defined `routed_interface`.
83 92
 #
84 93
 nspawn_primary_interface: "{{ nspawn_networks['nspawn_address']['bridge'] }}"
85 94
 

+ 1
- 1
tasks/nspawn_networking.yml View File

@@ -101,7 +101,7 @@
101 101
           {%-       set _ = start_commands.append('-/sbin/ip link set dev ' + mv_interface + ' up') %}
102 102
           {%        if hostvars[inventory_hostname][key.split('_')[0] + '_cidr'] is defined and (value.address is undefined) %}
103 103
           {%          set net_cidr = hostvars[inventory_hostname][key.split('_')[0] + '_cidr'] %}
104
-          {%          set _ = start_commands.append('-/sbin/ip route add ' + net_cidr + ' dev ' + nspawn_primary_interface + ' metric 100 proto kernel scope link table local') %}
104
+          {%          set _ = start_commands.append('-/sbin/ip route add ' + net_cidr + ' dev ' + (value.routed_interface | default(nspawn_primary_interface)) + ' metric 100 proto kernel scope link table local') %}
105 105
           {%        elif (value.address is defined) and ((interface_data['ipv4'] | default({'address': none}))['address'] != value.address) %}
106 106
           {%          set _ = start_commands.append('-/sbin/ip address add ' + value.address + '/' + (value.netmask | default('32')) + ' dev ' + mv_interface + ' scope host') %}
107 107
           {%-       endif %}

Loading…
Cancel
Save