diff options
author | uvok cheetah | 2024-04-21 17:18:18 +0200 |
---|---|---|
committer | uvok cheetah | 2024-04-21 17:18:18 +0200 |
commit | 0635a930f397b41ccaab42e89135f3fad9b2a275 (patch) | |
tree | 222a890a169e4e7c4b4dc7d93d222897ed0a22a8 | |
parent | b6f60ce633aa8585dca0ee2f78f9aae44365602e (diff) |
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
-rw-r--r-- | roles/uvok_bird/tasks/main.yml | 59 |
1 files changed, 53 insertions, 6 deletions
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 |