Browse Source

Moved all the bird stuff around so network roles can add configuration

Till Klocke 9 years ago
parent
commit
af48569ce9

+ 0 - 4
roles/internal/bird/defaults/main.yml

@@ -1,4 +0,0 @@
----
-# defaults file for bird
-
-bird_configure: true

+ 0 - 17
roles/internal/bird/meta/main.yml

@@ -1,17 +0,0 @@
----
-galaxy_info:
-  author: Till Klocke
-  description: Installs and configures bird routing daemon
-  company: Freifunk Dortmund
-  license: MIT
-  min_ansible_version: 1.2
-  platforms:
-  - name: Ubuntu
-    versions:
-    - all
-  - name: Debian
-    versions:
-    - all
-  categories:
-  - networking
-dependencies: []

+ 0 - 10
roles/internal/bird/tasks/debian.yml

@@ -1,10 +0,0 @@
-- name: Add GPG key for Wheezy backports
-  when: ansible_distribution_release == 'wheezy'
-  apt_key: keyserver=pgpkeys.mit.edu id=8B48AD6246925553
-
-- name: Add Wheezy backports
-  when: ansible_distribution_release == 'wheezy'
-  apt_repository: repo='deb http://http.debian.net/debian wheezy-backports main' state=present update_cache=yes
-
-- name: Install bird routing daemon
-  apt: name=bird state=present default_release={{bird_default_release}}

+ 0 - 19
roles/internal/bird/templates/bird.conf.j2

@@ -1,19 +0,0 @@
-#
-# This file is managed by ansible. Do not edit by hand!
-#
-
-log syslog all;
-router id {{bird_router_id}};
-
-{% for template in bird_templates %}
-template {{template.header}} {
-  {{template.content|indent(2,false)}}
-};
-
-{% endfor %}
-{% for protocol in bird_protocols %}
-protocol {{protocol.header}} {
-  {{protocol.content|indent(2,false)}}
-};
-
-{% endfor %}

+ 0 - 19
roles/internal/bird/templates/bird6.conf.j2

@@ -1,19 +0,0 @@
-#
-# This file is managed by ansible. Do not edit by hand!
-#
-
-log syslog all;
-router id {{bird6_router_id}};
-
-{% for template in bird6_templates %}
-template {{template.header}} {
-  {{template.content|indent(2,false)}}
-};
-
-{% endfor %}
-{% for protocol in bird6_protocols %}
-protocol {{protocol.header}} {
-  {{protocol.content|indent(2,false)}}
-};
-
-{% endfor %}

+ 0 - 2
roles/internal/bird/vars/Debian-jessie.yml

@@ -1,2 +0,0 @@
-bird_config_dir: /etc/bird
-bird_default_release: ""

+ 0 - 2
roles/internal/bird/vars/Debian-wheezy.yml

@@ -1,2 +0,0 @@
-bird_config_dir: /etc/bird
-bird_default_release: wheezy-backports

+ 0 - 2
roles/internal/bird/vars/Ubuntu-trusty.yml

@@ -1,2 +0,0 @@
-bird_config_dir: /etc/bird
-bird_default_release: ""

+ 0 - 2
roles/internal/bird/vars/main.yml

@@ -1,2 +0,0 @@
----
-# vars file for bird

roles/internal/bird/README.md → roles/internal/ffdo.bird/README.md


+ 2 - 0
roles/internal/ffdo.bird/defaults/main.yml

@@ -0,0 +1,2 @@
+---
+# defaults file for ffdo.bird

+ 1 - 1
roles/internal/bird/handlers/main.yml

@@ -1,5 +1,5 @@
 ---
-# handlers file for bird
+# handlers file for ffdo.bird
 
 - name: Restart bird daemons
   service: name={{item}} state=restarted

+ 139 - 0
roles/internal/ffdo.bird/meta/main.yml

@@ -0,0 +1,139 @@
+---
+galaxy_info:
+  author: your name
+  description: 
+  company: your company (optional)
+  # If the issue tracker for your role is not on github, uncomment the
+  # next line and provide a value
+  # issue_tracker_url: http://example.com/issue/tracker
+  # Some suggested licenses:
+  # - BSD (default)
+  # - MIT
+  # - GPLv2
+  # - GPLv3
+  # - Apache
+  # - CC-BY
+  license: license (GPLv2, CC-BY, etc)
+  min_ansible_version: 1.2
+  #
+  # Below are all platforms currently available. Just uncomment
+  # the ones that apply to your role. If you don't see your 
+  # platform on this list, let us know and we'll get it added!
+  #
+  #platforms:
+  #- name: EL
+  #  versions:
+  #  - all
+  #  - 5
+  #  - 6
+  #  - 7
+  #- name: GenericUNIX
+  #  versions:
+  #  - all
+  #  - any
+  #- name: Fedora
+  #  versions:
+  #  - all
+  #  - 16
+  #  - 17
+  #  - 18
+  #  - 19
+  #  - 20
+  #  - 21
+  #  - 22
+  #- name: Windows
+  #  versions:
+  #  - all
+  #  - 2012R2
+  #- name: SmartOS
+  #  versions:
+  #  - all
+  #  - any
+  #- name: opensuse
+  #  versions:
+  #  - all
+  #  - 12.1
+  #  - 12.2
+  #  - 12.3
+  #  - 13.1
+  #  - 13.2
+  #- name: Amazon
+  #  versions:
+  #  - all
+  #  - 2013.03
+  #  - 2013.09
+  #- name: GenericBSD
+  #  versions:
+  #  - all
+  #  - any
+  #- name: FreeBSD
+  #  versions:
+  #  - all
+  #  - 8.0
+  #  - 8.1
+  #  - 8.2
+  #  - 8.3
+  #  - 8.4
+  #  - 9.0
+  #  - 9.1
+  #  - 9.1
+  #  - 9.2
+  #- name: Ubuntu
+  #  versions:
+  #  - all
+  #  - lucid
+  #  - maverick
+  #  - natty
+  #  - oneiric
+  #  - precise
+  #  - quantal
+  #  - raring
+  #  - saucy
+  #  - trusty
+  #  - utopic
+  #  - vivid
+  #- name: SLES
+  #  versions:
+  #  - all
+  #  - 10SP3
+  #  - 10SP4
+  #  - 11
+  #  - 11SP1
+  #  - 11SP2
+  #  - 11SP3
+  #- name: GenericLinux
+  #  versions:
+  #  - all
+  #  - any
+  #- name: Debian
+  #  versions:
+  #  - all
+  #  - etch
+  #  - jessie
+  #  - lenny
+  #  - squeeze
+  #  - wheezy
+  #
+  # Below are all categories currently available. Just as with
+  # the platforms above, uncomment those that apply to your role.
+  #
+  #categories:
+  #- cloud
+  #- cloud:ec2
+  #- cloud:gce
+  #- cloud:rax
+  #- clustering
+  #- database
+  #- database:nosql
+  #- database:sql
+  #- development
+  #- monitoring
+  #- networking
+  #- 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.
+  

+ 10 - 7
roles/internal/bird/tasks/main.yml

@@ -1,13 +1,16 @@
 ---
-# tasks file for bird
+# tasks file for ffdo.bird
 
-- include_vars: "{{ ansible_distribution }}-{{ ansible_distribution_release }}.yml"
-
-- include: debian.yml
-  when: ansible_distribution == "Debian"
+- name: Ensure bird include dirs exists
+  file:
+    dest: /etc/{{item}}
+    state: directory
+  with_items:
+  - bird.d
+  - bird6.d
 
-- include: debian.yml
-  when: ansible_distribution == "Ubuntu"
+- name: Ensure bird routing daemon is installed
+  apt: name=bird state=present
 
 - name: Create bird config dir 
   file: name={{bird_config_dir}} state=directory

+ 31 - 0
roles/internal/ffdo.bird/templates/bird.conf.j2

@@ -0,0 +1,31 @@
+#
+# This file is managed by ansible. Do not edit by hand!
+#
+
+log syslog all;
+router id {{mesh_ipv4|ipaddr('address')}};
+
+include "/etc/bird.d/*.cfg"
+
+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;
+};

+ 40 - 0
roles/internal/ffdo.bird/templates/bird6.conf.j2

@@ -0,0 +1,40 @@
+#
+# This file is managed by ansible. Do not edit by hand!
+#
+
+log syslog all;
+router id {{mesh_ipv4|ipaddr('address')}};
+
+include "/etc/bird6.d/*.cfg"
+
+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 {{mesh_ipv6|ipaddr('address')}};
+        local as {{supernode_as}};
+        import all;
+        export all;
+        next hop self;
+        direct;
+        gateway direct;
+}

+ 4 - 0
roles/internal/ffdo.bird/vars/main.yml

@@ -0,0 +1,4 @@
+---
+# vars file for ffdo.bird
+
+bird_config_dir: /etc/bird

+ 2 - 2
roles/internal/ffdo.gre-uplink/tasks/main.yml

@@ -23,9 +23,9 @@
     template: uplink_interfaces.j2
 
 - name: Install bird.conf
-  template: src=bird.conf.j2 dest={{bird_config_dir}}/bird.conf
+  template: src=bird.conf.j2 dest=/etc/bird.d/uplinks.conf
   notify: Restart bird daemons
 
 - name: Install bird6.conf
-  template: src=bird6.conf.j2 dest={{bird_config_dir}}/bird6.conf
+  template: src=bird6.conf.j2 dest=/etc/bird6.d/bird6.conf
   notify: Restart bird daemons

+ 1 - 35
roles/internal/ffdo.gre-uplink/templates/bird.conf.j2

@@ -2,32 +2,6 @@
 # This file is managed by ansible. Do not edit by hand!
 #
 
-log syslog all;
-router id {{supernode_mesh_ipv4|ipaddr('address')}};
-
-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;
-};
-
 {% if supernode_uplinks is defined %}
 {% for uplink in supernode_uplinks %}
 protocol bgp {{uplink.name}} from ibgp {
@@ -37,12 +11,4 @@ protocol bgp {{uplink.name}} from ibgp {
 };
 
 {% endfor %}
-{% endif %}
-
-{% for meshlink in supernode_mesh_backbones%}
-protocol bgp {{meshlink.name}} from ibgp {
-        source address {{supernode_mesh_ipv4|ipaddr('address')}};
-        neighbor {{meshlink.mesh_ip}} as {{supernode_as}};
-        default bgp_med 4;
-};
-{% endfor %}
+{% endif %}

+ 0 - 43
roles/internal/ffdo.gre-uplink/templates/bird6.conf.j2

@@ -2,41 +2,6 @@
 # This file is managed by ansible. Do not edit by hand!
 #
 
-log syslog all;
-router id {{supernode_mesh_ipv4|ipaddr('address')}};
-
-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 {{supernode_mesh_ipv6|ipaddr('address')}};
-        local as {{supernode_as}};
-        import all;
-        export all;
-        next hop self;
-        direct;
-        gateway direct;
-}
-
 {% if supernode_uplinks is defined %}
 template bgp uplink {
         local as {{supernode_uplinks[0].as}};
@@ -55,11 +20,3 @@ protocol bgp {{uplink.name}} from uplink {
 
 {% endfor %}
 {% endif %}
-
-{% for meshlink in supernode_mesh_backbones %}
-protocol bgp {{meshlink.name}} from ibgp {
-        neighbor {{meshlink.address_v6}} as {{supernode_as}};
-        default bgp_med 4;
-}
-
-{% endfor %}

+ 8 - 0
roles/internal/ffdo.mesh-interfaces/tasks/main.yml

@@ -15,3 +15,11 @@
     template: mesh_interfaces.j2
   - file: backbone.cfg
     template: gre-tunnel.j2
+
+- name: Install bird.conf
+  template: src=bird.conf.j2 dest=/etc/bird.d/mesh.conf
+  notify: Restart bird daemons
+
+- name: Install bird6.conf
+  template: src=bird6.conf.j2 dest=/etc/bird6.d/mesh.conf
+  notify: Restart bird daemons

+ 11 - 0
roles/internal/ffdo.mesh-interfaces/templates/bird.conf.j2

@@ -0,0 +1,11 @@
+#
+# This file is managed by ansible. Do not edit by hand!
+#
+
+{% for meshlink in supernode_mesh_backbones%}
+protocol bgp {{meshlink.name}} from ibgp {
+        source address {{supernode_mesh_ipv4|ipaddr('address')}};
+        neighbor {{meshlink.mesh_ip}} as {{supernode_as}};
+        default bgp_med 4;
+};
+{% endfor %}

+ 7 - 0
roles/internal/ffdo.mesh-interfaces/templates/bird6.conf.j2

@@ -0,0 +1,7 @@
+{% for meshlink in supernode_mesh_backbones %}
+protocol bgp {{meshlink.name}} from ibgp {
+        neighbor {{meshlink.address_v6}} as {{supernode_as}};
+        default bgp_med 4;
+}
+
+{% endfor %}