allow to set a custom location for birds config

n0emis 4 years ago
parent 90249ad430
commit 4f3c580294
Signed by untrusted user: n0emis
GPG Key ID: 00FAF748B777CF10

@ -1,3 +1,4 @@
---
dn42_wg_private_key: "foobar2342" dn42_wg_private_key: "foobar2342"
dn42_wg_default_if_prefix: "dn42_" dn42_wg_default_if_prefix: "dn42_"
@ -7,11 +8,15 @@ dn42_local_v4: "172.17.0.1"
dn42_local_v6: "fe80::1" dn42_local_v6: "fe80::1"
dn42_local_as: "424242424243" dn42_local_as: "424242424243"
dn42_bird2_directory: "/etc/bird/"
dn42_bird2_template: "bird2/bird.conf.j2"
dn42_bird2_peer_template: "bird2/peer.conf.j2"
dn42_enable_roa: yes dn42_enable_roa: yes
dn42_roa_v4_source: "https://dn42.burble.com/roa/dn42_roa_bird2_4.conf" dn42_roa_v4_source: "https://dn42.burble.com/roa/dn42_roa_bird2_4.conf"
dn42_roa_v4_location: "/etc/bird/roa_dn42.conf" dn42_roa_v4_location: "{{ dn42_bird2_directory }}/roa_dn42.conf"
dn42_roa_v6_source: "https://dn42.burble.com/roa/dn42_roa_bird2_6.conf" dn42_roa_v6_source: "https://dn42.burble.com/roa/dn42_roa_bird2_6.conf"
dn42_roa_v6_location: "/etc/bird/roa_dn42_v6.conf" dn42_roa_v6_location: "{{ dn42_bird2_directory }}/roa_dn42_v6.conf"
dn42_roa_cronjob: "curl -sfSLR -o{{ dn42_roa_v4_location }} -z{{ dn42_roa_v4_location }} {{ dn42_roa_v4_source }} && curl -sfSLR -o{{ dn42_roa_v6_location }} -z{{ dn42_roa_v6_location }} {{ dn42_roa_v6_source }} && birdc configure" dn42_roa_cronjob: "curl -sfSLR -o{{ dn42_roa_v4_location }} -z{{ dn42_roa_v4_location }} {{ dn42_roa_v4_source }} && curl -sfSLR -o{{ dn42_roa_v6_location }} -z{{ dn42_roa_v6_location }} {{ dn42_roa_v6_source }} && birdc configure"
@ -23,9 +28,6 @@ dn42_pingfinder_logfile: "/dev/null"
dn42_configure_linux_network_table: no dn42_configure_linux_network_table: no
dn42_bird2_template: "bird2/bird.conf.j2"
dn42_bird2_peer_template: "bird2/peer.conf.j2"
dn42_peers: dn42_peers:
- name: "neighbour" - name: "neighbour"
as: "4242424242" as: "4242424242"

@ -1,26 +1,32 @@
--- ---
#- import_tasks: bird-repos.yml #- import_tasks: bird-repos.yml
- name: Install bird2
apt: apt:
name: "bird2" name: "bird2"
state: present state: present
- name: Ensure birds config foler exists
file:
path: "{{ dn42_bird2_directory }}"
state: directory
owner: "bird"
group: "bird"
- name: Copy bird config-file - name: Copy bird config-file
template: template:
dest: /etc/bird/bird.conf dest: "{{ dn42_bird2_directory }}/bird.conf"
src: "{{ dn42_bird2_template }}" src: "{{ dn42_bird2_template }}"
notify: reload bird notify: reload bird
- name: Ensure birds peer foler exists - name: Ensure birds peer foler exists
file: file:
path: "/etc/bird/peers" path: "{{ dn42_bird2_directory }}/peers"
state: directory state: directory
owner: "bird" owner: "bird"
group: "bird" group: "bird"
- name: Copy birds peer config-files - name: Copy birds peer config-files
template: template:
dest: "/etc/bird/peers/{{ peer.name }}.conf" dest: "{{ dn42_bird2_directory }}/peers/{{ peer.name }}.conf"
src: "{{ dn42_bird2_peer_template }}" src: "{{ dn42_bird2_peer_template }}"
when: (not peer.state is defined) or peer.state != "absent" when: (not peer.state is defined) or peer.state != "absent"
loop: "{{ dn42_peers }}" loop: "{{ dn42_peers }}"
@ -30,7 +36,7 @@
- name: Remove bird peer config-files - name: Remove bird peer config-files
file: file:
path: "/etc/bird/peers/{{ peer.name }}.conf" path: "{{ dn42_bird2_directory }}/peers/{{ peer.name }}.conf"
state: absent state: absent
when: peer.state is defined and peer.state == "absent" when: peer.state is defined and peer.state == "absent"
loop: "{{ dn42_peers }}" loop: "{{ dn42_peers }}"

Loading…
Cancel
Save