Add bird role
This commit is contained in:
parent
4a3ba6f366
commit
0d705bc922
6 changed files with 125 additions and 0 deletions
3
roles/bird/defaults/main.yml
Normal file
3
roles/bird/defaults/main.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
bird_ospf_interfaces: {}
|
||||
...
|
11
roles/bird/handlers/main.yml
Normal file
11
roles/bird/handlers/main.yml
Normal 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
37
roles/bird/tasks/main.yml
Normal 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
|
||||
...
|
37
roles/bird/templates/bird.conf
Normal file
37
roles/bird/templates/bird.conf
Normal 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 %}
|
||||
};
|
||||
}
|
37
roles/bird/templates/bird6.conf
Normal file
37
roles/bird/templates/bird6.conf
Normal 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 %}
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue