Przeglądaj źródła

The role supernode-interfaces now handles configuration of bird and therefore also depends on the bird role.

Till Klocke 9 lat temu
rodzic
commit
6168958c62

+ 2 - 5
roles/supernode-interfaces/meta/main.yml

@@ -128,8 +128,5 @@ galaxy_info:
   #- packaging
   #- system
   #- web
-dependencies: []
-  # List your role dependencies here, one per line.
-  # Be sure to remove the '[]' above if you add dependencies
-  # to this list.
-  
+dependencies:
+- { role: bird, bird_configure: false }

+ 9 - 1
roles/supernode-interfaces/tasks/main.yml

@@ -5,4 +5,12 @@
   when: ansible_distribution == 'Debian'
 
 - include: debian.yml
-  when: ansible_distribution == 'Ubuntu'
+  when: ansible_distribution == 'Ubuntu'
+
+- name: Install bird.conf
+  template: src=bird.conf.j2 dest={{bird_config_dir}}/bird.conf
+  notify: Restart bird daemons
+
+- name: Install bird6.conf
+  template: src=bird6.conf.j2 dest={{bird_config_dir}}/bird6.conf
+  notify: Restart bird daemons

+ 42 - 0
roles/supernode-interfaces/templates/bird.conf.j2

@@ -0,0 +1,42 @@
+log syslog all;
+router id {{supernode_mesh_ipv4}};
+
+protocol direct {
+        interface "*";
+};
+
+protocol kernel {
+        device routes;
+        import all;
+        export all;
+        kernel table 42;
+};
+
+protocol device {
+        scan time 8;
+};
+
+template bgp ibgp {
+        local as {{supernode_as}};
+        import all;
+        export all;
+        next hop self;
+        multihop 64;
+};
+
+{% for uplink in supernode_uplinks %}
+protocol bgp {{uplink.name}} from ibgp {
+        source address {{uplink.address}};
+        neighbor {{uplink.dstaddr}} as {{uplink.as}};
+        default bgp_med 2;
+};
+
+{% endfor %}
+
+{% for meshlink in supernode_mesh_backbones%}
+protocol bgp {{meshlink.name}} from ibgp {
+        source address {{supernode_mesh_ipv4}};
+        neighbor {{meshlink.mesh_ip}} as {{supernode_as}};
+        default bgp_med 4;
+};
+{% endfor %}

+ 59 - 0
roles/supernode-interfaces/templates/bird6.conf.j2

@@ -0,0 +1,59 @@
+log syslog all;
+router id {{supernode_mesh_ipv4}};
+
+protocol static uplink_hostroute {
+   import all;
+   export all;
+}
+
+protocol direct {
+        interface "*";
+}
+
+protocol kernel {
+        persist;
+        device routes;
+        scan time 20;
+        import all;
+        export all;
+        kernel table 42;
+}
+
+protocol device {
+        scan time 10;
+}
+
+template bgp ibgp {
+        source address 2a03:2260:50:5::8;
+        local as 65403;
+        import all;
+        export all;
+        next hop self;
+        direct;
+        gateway direct;
+}
+
+template bgp uplink {
+        local as 65403;
+        import all;
+        export all;
+        next hop self;
+        direct;
+        multihop 64;
+}
+
+{% for uplink in supernode_uplinks %}
+protocol bgp {{uplink.name}} from uplink {
+        neighbor {{uplink.adress_v6_pure}} as {{uplink.as}};
+        default bgp_med 2;
+}
+
+{% endfor %}
+
+{% for meshlink in supernode_mesh_backbones %}
+protocol bgp {{meshlink.name}} from ibgp {
+        neighbor {{meshlink.address_v6}} as {{supernode_as}};
+        default bgp_med 4;
+}
+
+{% endfor %}