From 4f3c5802947888c808b8306271b93439f13e76f9 Mon Sep 17 00:00:00 2001 From: Simeon 'n0emis' Keske Date: Sun, 7 Mar 2021 00:19:10 +0100 Subject: [PATCH] allow to set a custom location for birds config --- defaults/main.yml | 12 +++++++----- tasks/bird2.yml | 16 +++++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 4602e90..172da86 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,3 +1,4 @@ +--- dn42_wg_private_key: "foobar2342" dn42_wg_default_if_prefix: "dn42_" @@ -7,11 +8,15 @@ dn42_local_v4: "172.17.0.1" dn42_local_v6: "fe80::1" 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_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_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" @@ -23,9 +28,6 @@ dn42_pingfinder_logfile: "/dev/null" dn42_configure_linux_network_table: no -dn42_bird2_template: "bird2/bird.conf.j2" -dn42_bird2_peer_template: "bird2/peer.conf.j2" - dn42_peers: - name: "neighbour" as: "4242424242" diff --git a/tasks/bird2.yml b/tasks/bird2.yml index 732464b..93e3ab0 100644 --- a/tasks/bird2.yml +++ b/tasks/bird2.yml @@ -1,26 +1,32 @@ --- #- import_tasks: bird-repos.yml -- name: Install bird2 apt: name: "bird2" state: present +- name: Ensure birds config foler exists + file: + path: "{{ dn42_bird2_directory }}" + state: directory + owner: "bird" + group: "bird" + - name: Copy bird config-file template: - dest: /etc/bird/bird.conf + dest: "{{ dn42_bird2_directory }}/bird.conf" src: "{{ dn42_bird2_template }}" notify: reload bird - name: Ensure birds peer foler exists file: - path: "/etc/bird/peers" + path: "{{ dn42_bird2_directory }}/peers" state: directory owner: "bird" group: "bird" - name: Copy birds peer config-files template: - dest: "/etc/bird/peers/{{ peer.name }}.conf" + dest: "{{ dn42_bird2_directory }}/peers/{{ peer.name }}.conf" src: "{{ dn42_bird2_peer_template }}" when: (not peer.state is defined) or peer.state != "absent" loop: "{{ dn42_peers }}" @@ -30,7 +36,7 @@ - name: Remove bird peer config-files file: - path: "/etc/bird/peers/{{ peer.name }}.conf" + path: "{{ dn42_bird2_directory }}/peers/{{ peer.name }}.conf" state: absent when: peer.state is defined and peer.state == "absent" loop: "{{ dn42_peers }}"