forked from 9pfs/dn42-ansible
39 lines
1.3 KiB
YAML
39 lines
1.3 KiB
YAML
- name: Configure peerings
|
|
hosts: routers
|
|
remote_user: root
|
|
tasks:
|
|
- name: Include per-node peering data
|
|
include_vars: "{{ playbook_dir }}/peerings/{{ pop_loc }}.yaml"
|
|
ignore_errors: false
|
|
- name: Generate systemd .netdev files
|
|
ansible.builtin.template:
|
|
src: ext-peer.netdev.j2
|
|
dest: "/etc/systemd/network/dn42{{ item.remotename }}.netdev"
|
|
mode: '0644'
|
|
loop: "{{ peers }}"
|
|
when: peers is defined
|
|
register: netdev_files
|
|
- name: Generate systemd .network files
|
|
ansible.builtin.template:
|
|
src: ext-peer.network.j2
|
|
dest: "/etc/systemd/network/dn42{{ item.remotename }}.network"
|
|
mode: '0644'
|
|
loop: "{{ peers }}"
|
|
when: peers is defined
|
|
register: network_files
|
|
- name: Generate BGP peering files
|
|
ansible.builtin.template:
|
|
src: ext-peer.bgp.conf.j2
|
|
dest: "/etc/bird/peers/dn42{{ item.remotename }}.conf"
|
|
mode: '0644'
|
|
loop: "{{ peers }}"
|
|
register: bgp_files
|
|
when: peers is defined
|
|
- name: Reload systemd-networkd
|
|
ansible.builtin.command: networkctl reload
|
|
when: peers is defined
|
|
- name: Reload bird
|
|
ansible.builtin.systemd_service:
|
|
name: bird.service
|
|
state: reloaded
|
|
when: peers is defined
|