Files
dn42-ansible/roles/bird/tasks/main.yaml

75 lines
1.6 KiB
YAML

- name: "Ensure bird2 is installed"
ansible.builtin.apt:
state: present
name:
- bird2
- name: "Ensure bird2 is enabled"
ansible.builtin.systemd_service:
name: bird
enabled: true
- name: "Ensure /etc/bird/peers directory is present"
ansible.builtin.file:
path: "/etc/bird/peers"
state: directory
mode: '0755'
owner: root
group: root
- name: "Ensure /etc/bird/include directory is present"
ansible.builtin.file:
path: "/etc/bird/include"
state: directory
mode: '0755'
owner: root
group: root
- name: "Ensure bird log file exists"
ansible.builtin.file:
path: /var/log/bird.log
state: file
mode: '0644'
owner: bird
group: bird
- name: "Setup bird2 config"
ansible.builtin.template:
src: bird.conf.j2
dest: /etc/bird/bird.conf
mode: "0644"
notify:
- "Reload bird"
- name: "Ensure OSPF config exists"
ansible.builtin.template:
src: ospf.conf.j2
dest: /etc/bird/include/ospf.conf
mode: '0644'
notify:
- "Reload bird"
- name: "Setup internal bgp peers"
ansible.builtin.template:
src: internal_peer.conf.j2
dest: /etc/bird/peers/{{ peer.name }}.conf
mode: "0644"
loop: "{{ internal_peers | default([]) }}"
loop_control:
loop_var: peer
when: internal_peers is not none
notify:
- "Reload bird"
- name: "Setup external bgp peers"
ansible.builtin.template:
src: peer.conf.j2
dest: /etc/bird/peers/{{ peer.name }}.conf
mode: "0644"
loop: "{{ peers | default([]) }}"
loop_control:
loop_var: peer
when: peers is not none
notify:
- "Reload bird"