123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377 |
- #
- # Bird routing daemon
- #
- {%- set roles = salt['pillar.get']('nodes:' ~ grains['id'] ~ ':roles', []) %}
- include:
- - network.interfaces
- bird-repo:
- {% if grains.oscodename in ['jessie', 'wheezy'] %}
- pkgrepo.managed:
- - comments: "# Official bird repo"
- - human_name: Official bird repository
- - name: "deb http://bird.network.cz/debian/ {{ grains['oscodename'] }} main"
- - dist: {{ grains['oscodename'] }}
- - file: /etc/apt/sources.list.d/bird.list
- - key_url: salt://bird/bird_apt.key
- {% else %}
- file.absent:
- - name: /etc/apt/sources.list.d/bird.list
- {% endif %}
- bird-pkg:
- pkg.installed:
- - name: bird
- {% if grains.oscodename in ['jessie', 'wheezy'] %}
- - require:
- - pkgrepo: bird-repo
- {% endif %}
- # Make sure both services are enabled
- bird:
- service.running:
- - enable: True
- - running: True
- bird6:
- service.running:
- - enable: True
- - running: True
- # Reload commands for bird{,6} to be tied to files which should trigger reconfiguration
- bird-configure:
- cmd.wait:
- - name: /usr/sbin/birdc configure
- - watch: []
- bird6-configure:
- cmd.wait:
- - name: /usr/sbin/birdc6 configure
- - watch: []
- /etc/bird:
- file.directory:
- - mode: 750
- - user: bird
- - group: bird
- - require:
- - pkg: bird
- /etc/bird/bird.d:
- file.directory:
- - makedirs: true
- - mode: 755
- - user: root
- - group: bird
- - require:
- - file: /etc/bird
- /etc/bird/bird.conf:
- file.managed:
- - source: salt://bird/bird.conf
- - template: jinja
- proto: v4
- - require:
- - file: /etc/bird/bird.d
- - require_in:
- - service: bird
- - watch_in:
- - cmd: bird-configure
- - mode: 644
- - user: root
- - group: bird
- /etc/bird/bird6.d:
- file.directory:
- - makedirs: true
- - mode: 755
- - user: root
- - group: bird
- - require:
- - file: /etc/bird
- /etc/bird/bird6.conf:
- file.managed:
- - source: salt://bird/bird.conf
- - template: jinja
- proto: v6
- - require:
- - file: /etc/bird/bird6.d
- - watch_in:
- - cmd: bird6-configure
- - mode: 644
- - user: root
- - group: bird
- - require_in:
- - service: bird6
- #
- # External VRF / Routing table?
- #
- /etc/bird/bird.d/VRF_external.conf:
- file.managed:
- - source: salt://bird/VRF_external.conf
- - template: jinja
- proto: v4
- - watch_in:
- - cmd: bird-configure
- - require:
- - file: /etc/bird/bird.d
- - require_in:
- - service: bird
- /etc/bird/bird6.d/VRF_external.conf:
- file.managed:
- - source: salt://bird/VRF_external.conf
- - template: jinja
- proto: v6
- - watch_in:
- - cmd: bird6-configure
- - require:
- - file: /etc/bird/bird6.d
- - require_in:
- - service: bird6
- /etc/bird/bird.d/external.conf:
- file.absent
- /etc/bird/bird6.d/external.conf:
- file.absent
- #
- # IGP / OSPF
- #
- /etc/bird/bird.d/IGP.conf:
- file.managed:
- - source: salt://bird/IGP.conf
- - template: jinja
- proto: v4
- - watch_in:
- - cmd: bird-configure
- - require:
- - file: /etc/bird/bird.d
- - require_in:
- - service: bird
- /etc/bird/bird6.d/IGP.conf:
- file.managed:
- - source: salt://bird/IGP.conf
- - template: jinja
- proto: v6
- - watch_in:
- - cmd: bird6-configure
- - require:
- - file: /etc/bird/bird6.d
- - require_in:
- - service: bird6
- # Compatibility glue
- /etc/bird/bird6.d/IGP6.conf:
- file.absent:
- - watch_in:
- - cmd: bird-configure
- #
- # iBGP
- #
- /etc/bird/ff-policy.conf:
- file.managed:
- - source: salt://bird/ff-policy.conf
- - template: jinja
- proto: v4
- - watch_in:
- - cmd: bird-configure
- - require:
- - file: /etc/bird/bird.d
- - require_in:
- - service: bird
- /etc/bird/ff-policy6.conf:
- file.managed:
- - source: salt://bird/ff-policy.conf
- - template: jinja
- proto: v6
- - watch_in:
- - cmd: bird6-configure
- - require:
- - file: /etc/bird/bird6.d
- - require_in:
- - service: bird6
- /etc/bird/bird.d/ibgp.conf:
- file.managed:
- - source: salt://bird/ibgp.conf
- - template: jinja
- proto: v4
- - watch_in:
- - cmd: bird-configure
- - require:
- - file: /etc/bird/bird.d
- - require_in:
- - service: bird
- /etc/bird/bird6.d/ibgp.conf:
- file.managed:
- - source: salt://bird/ibgp.conf
- - template: jinja
- proto: v6
- - watch_in:
- - cmd: bird6-configure
- - require:
- - file: /etc/bird/bird6.d
- - require_in:
- - service: bird6
- #
- # FFRL-exit
- #
- {% if 'ffrl-exit' in roles %}
- /etc/bird/bird.d/ffrl.conf:
- file.managed:
- - source: salt://bird/ffrl.conf
- - template: jinja
- proto: v4
- - watch_in:
- - cmd: bird-configure
- - require:
- - file: /etc/bird/bird.d
- - require_in:
- - service: bird
- /etc/bird/bird6.d/ffrl.conf:
- file.managed:
- - source: salt://bird/ffrl.conf
- - template: jinja
- proto: v6
- - watch_in:
- - cmd: bird6-configure
- - require:
- - file: /etc/bird/bird6.d
- - require_in:
- - service: bird6
- /etc/bird/bird.d/bogon_unreach.conf:
- file.managed:
- - source: salt://bird/bogon_unreach.conf
- - template: jinja
- proto: v4
- - watch_in:
- - cmd: bird-configure
- - require:
- - file: /etc/bird/bird.d
- - require_in:
- - service: bird
- /etc/bird/bird6.d/bogon_unreach.conf:
- file.managed:
- - source: salt://bird/bogon_unreach.conf
- - template: jinja
- proto: v6
- - watch_in:
- - cmd: bird6-configure
- - require:
- - file: /etc/bird/bird6.d
- - require_in:
- - service: bird6
- {% else %}
- /etc/bird/bird.d/ffrl.conf:
- file.absent
- /etc/bird/bird6.d/ffrl.conf:
- file.absent
- /etc/bird/bird.d/bogon_unreach.conf:
- file.absent
- /etc/bird/bird6.d/bogon_unreach.conf:
- file.absent
- {% endif %}
- #
- # B.A.T.M.A.N. Gateway
- #
- {% if 'batman_gw' in roles %}
- /etc/bird/bird.d/mesh_routes.conf:
- file.managed:
- - source: salt://bird/mesh_routes.conf
- - template: jinja
- - watch_in:
- - cmd: bird-configure
- - require:
- - file: /etc/bird/bird.d
- - require_in:
- - service: bird
- /etc/bird/bird6.d/mesh_routes.conf:
- file.managed:
- - source: salt://bird/mesh_routes.conf
- - template: jinja
- - watch_in:
- - cmd: bird6-configure
- - require:
- - file: /etc/bird/bird6.d
- - require_in:
- - service: bird6
- {% else %}
- /etc/bird/bird.d/mesh_routes.conf:
- file.absent
- /etc/bird/bird6.d/mesh_routes.conf:
- file.absent
- {% endif %}
- #
- # L3 Access
- #
- {% if 'l3_access' in roles %}
- /etc/bird/bird.d/l3-access.conf:
- file.managed:
- - source: salt://bird/l3-access.conf
- - template: jinja
- /etc/bird/bird6.d/l3-access.conf:
- file.managed:
- - source: salt://bird/l3-access.conf
- - template: jinja
- {% else %}
- /etc/bird/bird.d/l3-access.conf:
- file.absent
- /etc/bird/bird6.d/l3-access.conf:
- file.absent
- {% endif %}
- #
- # RAdvd (for B.A.T.M.A.N. Gateways / L3-Access)
- #
- {% if ('batman_gw' in roles and grains.id.startswith('gw')) or "l3_access" in roles %}
- /etc/bird/bird6.d/radv.conf:
- file.managed:
- - source: salt://bird/radv.conf
- - template: jinja
- - watch_in:
- - cmd: bird6-configure
- - require:
- - file: /etc/bird/bird6.d
- - require_in:
- - service: bird6
- {% else %}
- /etc/bird/bird6.d/radv.conf:
- file.absent:
- - watch_in:
- - cmd: bird6-configure
- {% endif %}
|