Просмотр исходного кода

We can now configure the network on debian based distributions

Till Klocke 9 лет назад
Родитель
Сommit
fdec963b83

+ 4 - 0
roles/ff-supernode/handlers/main.yml

@@ -1,2 +1,6 @@
 ---
 # handlers file for ff-supernode
+# In Ubuntu restarting the networking service causes problems.
+# So we use ifdown and ifup to enable changes
+- name: Restart network
+  shell: ifdown --exclude=lo -a && ifup --exclude=lo -a

+ 4 - 0
roles/ff-supernode/tasks/debian.yml

@@ -0,0 +1,4 @@
+- name: Install network config
+  when: supernode_interfaces is defined
+  template: src=interfaces.j2 dest=/etc/network/interfaces
+  notify: Restart network

+ 6 - 0
roles/ff-supernode/tasks/main.yml

@@ -1,2 +1,8 @@
 ---
 # tasks file for ff-supernode
+
+- include: debian.yml
+  when: ansible_distribution == 'Debian'
+
+- include: debian.yml
+  when: ansible_distribution == 'Ubuntu'

+ 27 - 0
roles/ff-supernode/templates/interfaces.j2

@@ -0,0 +1,27 @@
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+#
+# This file is generated by ansible
+#
+
+## Host Interfaces
+
+auto lo
+iface lo inet loopback
+
+{%for interface in supernode_interfaces %}
+{% if interface.auto is defined and interface.auto %}
+auto {{interface.name}}
+{% endif %}
+{% if interface.hotplug is defined and interface.hotplug %}
+allow-hotplug {{interface.name}}
+{% endif %}
+iface {{interface.name}} {{interface.proto}} {{interface.type}}
+{% if interface.config is defined %}
+{% for config in interface.config %}
+    {{config.key}} {{config.value}}
+{% endfor %}
+{% endif %}
+
+{% endfor %}

+ 23 - 1
test/application/supernode_pkg_vars.yml

@@ -56,4 +56,26 @@ bird6_protocols:
   - header: bgp node012 from ibgp
     content: |
       neighbor 2a03:2260:50:5::24 as 65403;
-      default bgp_med 4;
+      default bgp_med 4;
+
+supernode_interfaces:
+  - name: eth0
+    auto: true
+    proto: inet
+    type: dhcp
+    
+  - name: meshdummy0
+    auto: true
+    proto: inet 
+    type: manual
+    config:
+    - key: pre-up
+      value: ip link add $IFACE type dummy
+    - key: pre-up
+      value: ip link set address 02:ce:ef:ca:fe:2a dev $IFACE
+    - key: pre-up
+      value: ip link set up dev $IFACE
+    - key: post-down
+      value: ip link set down dev $IFACE
+    - key: up
+      value: batctl if add $IFACE

+ 9 - 1
test/integration/supernode/serverspec/test_spec.rb

@@ -19,6 +19,10 @@ end
 #  it { should be_enabled }
 #end
 
+describe port(10000) do
+  it { should be_listening.with('udp6') }
+end
+
 describe package('rng-tools') do
   it { should be_installed }
 end
@@ -84,4 +88,8 @@ end
 #describe service('bird6') do
 #  it { should be_running }
 #  it { should be_enabled }
-#end
+#end
+
+describe interface('meshdummy0') do
+  it { should exist }
+end