summaryrefslogtreecommitdiff
path: root/roles/uvok_bird/tasks/main.yml
blob: 942ad06d2e173d83bdcc5086e2901be9271438f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
---
# tasks file for uvok_bird
- 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 }}'
    dest: '{{ item.dest }}'
    mode: '0640'
    owner: 'bird'
    group: 'bird'
  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: '{{ 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 clearnet files
  ansible.posix.synchronize:
    src: 'files/'
    dest: '{{ uvok_bird_opts.config_dir }}'
    recursive: true
    archive: false
    compress: false
    rsync_opts:
      - '--chown=bird:bird'
      - '--chmod=0640'
      - '--include=*/'
      - '--include=clear*.conf'
      - '--exclude=*'
  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