dn42-ansible/setup.yml

87 lines
2.6 KiB
YAML

- name: Configure bird on routers
hosts: routers
remote_user: root
tasks:
- 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
- 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'
- 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
- name: Reload bird
ansible.builtin.systemd_service:
name: bird.service
enabled: true
state: reloaded
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