You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.2 KiB
YAML

---
#- import_tasks: bird-repos.yml
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: "{{ dn42_bird2_directory }}/bird.conf"
src: "{{ dn42_bird2_template }}"
notify: reload bird
- name: Ensure birds peer foler exists
file:
path: "{{ dn42_bird2_directory }}/peers"
state: directory
owner: "bird"
group: "bird"
- name: Copy birds peer config-files
template:
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 }}"
loop_control:
loop_var: "peer"
notify: reload bird
- name: Remove bird peer config-files
file:
path: "{{ dn42_bird2_directory }}/peers/{{ peer.name }}.conf"
state: absent
when: peer.state is defined and peer.state == "absent"
loop: "{{ dn42_peers }}"
loop_control:
loop_var: "peer"
notify: reload bird
- name: Ensure bird service is enabled and started
systemd:
name: "bird.service"
enabled: yes
state: started