ansible-borgbackup/tasks/main.yml
2018-08-30 23:37:26 +02:00

25 lines
789 B
YAML

---
# Due to inverse logic behaviour when searching for an item in an undefined list.
- name: setting facts
set_fact:
borgbackup_servers_group: "{{ groups.borgbackup_servers | default([]) }} "
borgbackup_management_group: "{{ groups.borgbackup_management | default([]) }}"
- include_tasks: install.yml
when: >
borgbackup_required == True or
inventory_hostname in borgbackup_servers_group
- include_tasks: borg-server.yml
when: inventory_hostname in borgbackup_servers_group
- include_tasks: borg-client.yml
when: >
borgbackup_required == True and
inventory_hostname not in borgbackup_servers_group
- include_tasks: management.yml
when: >
inventory_hostname in borgbackup_management_group and
inventory_hostname not in borgbackup_servers_group