Add bird role

This commit is contained in:
jeltz 2022-01-01 21:45:08 +01:00
parent 4a3ba6f366
commit 0d705bc922
6 changed files with 125 additions and 0 deletions

View file

@ -0,0 +1,3 @@
---
bird_ospf_interfaces: {}
...

View file

@ -0,0 +1,11 @@
---
- name: Reload bird
systemd:
name: bird.service
state: reloaded
- name: Reload bird6
systemd:
name: bird6.service
state: reloaded
...

37
roles/bird/tasks/main.yml Normal file
View file

@ -0,0 +1,37 @@
---
- name: Install bird
apt:
name: bird
- name: Configure bird
template:
src: bird.conf
dest: /etc/bird/bird.conf
owner: root
group: root
mode: u=rw,g=,o=
notify:
- Reload bird
- name: Configure bird6
template:
src: bird6.conf
dest: /etc/bird/bird6.conf
owner: root
group: root
mode: u=rw,g=,o=
notify:
- Reload bird6
- name: Enable and start bird
systemd:
name: bird.service
enabled: true
state: started
- name: Enable and start bird6
systemd:
name: bird6.service
enabled: true
state: started
...

View file

@ -0,0 +1,37 @@
{{ ansible_managed | comment }}
log syslog all;
router id {{ bird_router_id }};
protocol kernel {
scan time 60;
import none;
export all;
persist;
}
protocol device {
scan time 60;
}
protocol ospf backbone {
import filter {
{% if bird_ospf_src_v6 is defined %}
krt_prefsrc = {{ bird_ospf_src }};
{% endif %}
accept;
};
export all;
area 0 {
{% for name, iface in bird_ospf_interfaces.items() %}
interface "{{ name }}" {
{% if iface.stub | default(false) %}
stub;
{% elif iface.broadcast | default(false) %}
type broadcast;
{% endif %}
};
{% endfor %}
};
}

View file

@ -0,0 +1,37 @@
{{ ansible_managed | comment }}
log syslog all;
router id {{ bird_router_id }};
protocol kernel {
scan time 60;
import none;
export all;
persist;
}
protocol device {
scan time 60;
}
protocol ospf backbone {
import filter {
{% if bird_ospf_src_v6 is defined %}
krt_prefsrc = {{ bird_ospf_src_v6 }};
{% endif %}
accept;
};
export all;
area 0 {
{% for name, iface in bird_ospf_interfaces.items() %}
interface "{{ name }}" {
{% if iface.stub | default(false) %}
stub;
{% elif iface.broadcast | default(false) %}
type broadcast;
{% endif %}
};
{% endfor %}
};
}