From 0635a930f397b41ccaab42e89135f3fad9b2a275 Mon Sep 17 00:00:00 2001 From: uvok cheetah Date: Sun, 21 Apr 2024 17:18:18 +0200 Subject: bgp: Add various tasks - Install bird2 - Make bird log dir - Move common files up - Apply clearnet defines tpl - Copy clearnet files - Make bird peer dir - Remove config if variable false --- roles/uvok_bird/tasks/main.yml | 59 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 53 insertions(+), 6 deletions(-) (limited to 'roles') diff --git a/roles/uvok_bird/tasks/main.yml b/roles/uvok_bird/tasks/main.yml index 4bdcf35..2918f48 100644 --- a/roles/uvok_bird/tasks/main.yml +++ b/roles/uvok_bird/tasks/main.yml @@ -1,12 +1,24 @@ --- # tasks file for uvok_bird -- name: Ensure bird directory exists +- name: Install routing software + package: + name: + - bird2 + state: present +- name: Ensure bird config directory exists ansible.builtin.file: path: '{{ uvok_bird_opts.config_dir }}' state: directory mode: '0750' owner: 'bird' group: 'bird' +- name: Ensure bird log directory exists + ansible.builtin.file: + path: '/var/log/bird/' + state: directory + mode: '0750' + owner: 'bird' + group: 'bird' - name: Install common templates template: src: '{{ item.src }}' @@ -17,17 +29,32 @@ loop: - { src: 'bird.conf.j2', dest: '{{ uvok_bird_opts.config_dir }}/bird.conf' } - { src: 'defines.conf.j2', dest: '{{ uvok_bird_opts.config_dir }}/defines.conf' } + notify: configure bird +- name: Copy remaining common files + copy: + src: files/{{ item }} + dest: '{{ uvok_bird_opts.config_dir }}/{{ item }}' + mode: '0640' + owner: 'bird' + group: 'bird' + loop: + - "common.conf" + - "logging.conf" + notify: configure bird - name: Install clearnet templates template: - src: clearnet.conf.j2 - dest: '{{ uvok_bird_opts.config_dir }}/clearnet.conf' + src: '{{ item.src }}' + dest: '{{ item.dest }}' mode: '0640' owner: 'bird' group: 'bird' when: - uvok_bird_opts.clearnet + loop: + - { src: 'clearnet.conf.j2', dest: '{{ uvok_bird_opts.config_dir }}/clearnet.conf' } + - { src: 'clear_defines.conf.j2', dest: '{{ uvok_bird_opts.config_dir }}/clear_defines.conf' } notify: configure bird -- name: Copy remaining files +- name: Copy remaining clearnet files copy: src: files/{{ item }} dest: '{{ uvok_bird_opts.config_dir }}/{{ item }}' @@ -35,6 +62,26 @@ owner: 'bird' group: 'bird' loop: - - "common.conf" - - "logging.conf" + - "clear_functions.conf" + when: + - uvok_bird_opts.clearnet notify: configure bird +- name: Ensure bird peer directory exists + ansible.builtin.file: + path: '{{ uvok_bird_opts.config_dir }}/clear_peers/' + state: directory + mode: '0750' + owner: 'bird' + group: 'bird' + when: + - uvok_bird_opts.clearnet +- name: Remove clearnet config files + ansible.builtin.file: + path: '{{ item }}' + state: absent + loop: + - '{{ uvok_bird_opts.config_dir }}/clearnet.conf' + - '{{ uvok_bird_opts.config_dir }}/clear_defines.conf' + - '{{ uvok_bird_opts.config_dir }}/clear_functions.conf' + when: + - not uvok_bird_opts.clearnet -- cgit v1.2.3