121 lines
No EOL
3.8 KiB
YAML
121 lines
No EOL
3.8 KiB
YAML
- name: Configure bird on routers
|
|
hosts: routers
|
|
remote_user: root
|
|
tasks:
|
|
- name: Install bird on Arch
|
|
ansible.builtin.package:
|
|
name: bird
|
|
state: present
|
|
when: ansible_distribution == 'Archlinux'
|
|
- name: Install bird on Debian
|
|
ansible.builtin.package:
|
|
name: bird2
|
|
state: present
|
|
when: ansible_distribution == 'Debian'
|
|
- 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'
|
|
- 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'
|
|
- name: Add babel.conf
|
|
ansible.builtin.template:
|
|
src: bird-babel.j2
|
|
dest: /etc/bird/babel.conf
|
|
mode: '0644'
|
|
- 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'
|
|
- name: Add dn42-roa.service
|
|
ansible.builtin.copy:
|
|
src: dn42-roa.service
|
|
dest: /etc/systemd/system/dn42-roa.service
|
|
mode: '0644'
|
|
when: ansible_service_mgr == 'systemd'
|
|
- name: Add dn42-roa.timer
|
|
ansible.builtin.copy:
|
|
src: dn42-roa.timer
|
|
dest: /etc/systemd/system/dn42-roa.timer
|
|
mode: '0644'
|
|
when: ansible_service_mgr == 'systemd'
|
|
- name: Add igp-dummy-def.netdev
|
|
ansible.builtin.copy:
|
|
src: igp-dummy-def.netdev
|
|
dest: /etc/systemd/network/igp-dummy-def.netdev
|
|
mode: '0644'
|
|
when: ansible_service_mgr == 'systemd'
|
|
- name: Add igp-dummy-def.network
|
|
ansible.builtin.template:
|
|
src: igp-dummy-def.network.j2
|
|
dest: /etc/systemd/network/igp-dummy-def.network
|
|
mode: '0644'
|
|
when: ansible_service_mgr == 'systemd'
|
|
- name: reload systemd-networkd
|
|
ansible.builtin.command:
|
|
cmd: networkctl reload
|
|
when: ansible_service_mgr == 'systemd'
|
|
- name: Enable+start dn42-roa.timer
|
|
ansible.builtin.systemd_service:
|
|
name: dn42-roa.timer
|
|
enabled: true
|
|
state: started
|
|
when: ansible_service_mgr == 'systemd'
|
|
- name: Start dn42-roa.service, but ignore failures
|
|
ansible.builtin.systemd_service:
|
|
name: dn42-roa.service
|
|
state: started
|
|
ignore_errors: true
|
|
when: ansible_service_mgr == 'systemd'
|
|
- name: Reload bird
|
|
ansible.builtin.systemd_service:
|
|
name: bird.service
|
|
enabled: true
|
|
state: reloaded
|
|
throttle: 1
|
|
when: ansible_service_mgr == 'systemd'
|
|
- 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
|
|
- name: Push mkpeerkey.sh to hosts
|
|
ansible.builtin.copy:
|
|
src: mkpeerkey.sh
|
|
dest: /usr/local/bin/mkpeerkey.sh
|
|
mode: '0755'
|
|
- name: Push peerconf.sh to hosts
|
|
ansible.builtin.template:
|
|
src: peerconf.sh.j2
|
|
dest: /usr/local/bin/peerconf.sh
|
|
mode: '0755'
|
|
- name: Push mkpeerpsk.sh to hosts
|
|
ansible.builtin.copy:
|
|
src: mkpeerpsk.sh
|
|
dest: /usr/local/bin/mkpeerpsk.sh
|
|
mode: '0755' |