2024-11-22 03:49:35 +00:00
|
|
|
- name: Configure bird on routers
|
|
|
|
hosts: routers
|
|
|
|
remote_user: root
|
|
|
|
tasks:
|
2024-12-02 07:42:47 +00:00
|
|
|
- name: Create src/ directory on playbook host
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: src
|
|
|
|
state: directory
|
|
|
|
delegate_to: 127.0.0.1
|
|
|
|
run_once: true
|
|
|
|
- name: Clone bird-lg-go locally
|
|
|
|
ansible.builtin.git:
|
|
|
|
dest: src/bird-lg-go
|
|
|
|
repo: https://github.com/xddxdd/bird-lg-go
|
|
|
|
delegate_to: 127.0.0.1
|
|
|
|
run_once: true
|
2024-12-02 03:42:10 +00:00
|
|
|
- name: Create bird directory
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: /etc/bird
|
|
|
|
state: directory
|
|
|
|
mode: '0755'
|
|
|
|
- name: Create bird peers directory
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: /etc/bird/peers
|
|
|
|
state: directory
|
|
|
|
mode: '0755'
|
2024-11-22 03:49:35 +00:00
|
|
|
- name: Add internal bgp peers
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: int-bgp.j2
|
|
|
|
dest: /etc/bird/peers/internal.conf
|
|
|
|
mode: '0644'
|
|
|
|
- name: Add route collector peering
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: collector.conf
|
|
|
|
dest: /etc/bird/peers/collector.conf
|
|
|
|
mode: '0644'
|
2024-12-02 03:42:10 +00:00
|
|
|
- name: Add babel.conf
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: bird-babel.j2
|
|
|
|
dest: /etc/bird/babel.conf
|
|
|
|
mode: '0644'
|
2024-11-22 03:49:35 +00:00
|
|
|
- name: Add bird.conf in arch location
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: bird-conf.j2
|
|
|
|
dest: /etc/bird.conf
|
|
|
|
mode: '0644'
|
|
|
|
when: ansible_distribution == 'Archlinux'
|
|
|
|
- name: Add bird.conf in debian location
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: bird-conf.j2
|
|
|
|
dest: /etc/bird/bird.conf
|
|
|
|
mode: '0644'
|
|
|
|
when: ansible_distribution == 'Debian'
|
2024-12-02 03:42:10 +00:00
|
|
|
- name: Add dn42-roa.service
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: dn42-roa.service
|
|
|
|
dest: /etc/systemd/system/dn42-roa.service
|
|
|
|
mode: '0644'
|
|
|
|
- name: Add dn42-roa.timer
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: dn42-roa.timer
|
|
|
|
dest: /etc/systemd/system/dn42-roa.timer
|
|
|
|
mode: '0644'
|
|
|
|
- name: Enable+start dn42-roa.timer
|
|
|
|
ansible.builtin.systemd_service:
|
|
|
|
name: dn42-roa.timer
|
|
|
|
enabled: true
|
|
|
|
state: started
|
|
|
|
- name: Start dn42-roa.service, but ignore failures
|
|
|
|
ansible.builtin.systemd_service:
|
|
|
|
name: dn42-roa.service
|
|
|
|
state: started
|
|
|
|
ignore_errors: true
|
2024-11-22 03:49:35 +00:00
|
|
|
- name: Reload bird
|
|
|
|
ansible.builtin.systemd_service:
|
|
|
|
name: bird.service
|
|
|
|
enabled: true
|
|
|
|
state: reloaded
|
|
|
|
when: ansible_service_mgr == 'systemd'
|
2024-12-02 03:42:10 +00:00
|
|
|
- name: add sysctl files
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: sysctl-dn42.conf
|
|
|
|
dest: /etc/sysctl.d/sysctl-dn42.conf
|
|
|
|
mode: '0644'
|
|
|
|
- name: load sysctl configs
|
|
|
|
command: sysctl --system
|
|
|
|
ignore_errors: true
|