Skip to content
Snippets Groups Projects
config_nextcloud.yml 1.08 KiB
Newer Older
---
# file: roles/borgbackup/tasks/config_nextcloud.yml

- name: Set facts
  set_fact:
    application: 'nextcloud'
    application_id: '{{ nextcloud.id }}'
    application_remote_host: '{{ nextcloud.borg_host|default(false) }}'
    application_remote_repo: '{{ nextcloud.borg_repo|default(false) }}'
- name: Set facts without jails
  set_fact:
    application_dir: '{{ nextcloud_data_dir|default("/var/www/nextcloud/_data") }}/{{ nextcloud.id }}'
  when: nextcloud.jail is not defined
- name: Set facts with jails
  set_fact:
    application_dir: '{{ jailroot }}/{{ nextcloud.id }}/var/www/datanextcloud'
  when: nextcloud.jail is defined

- name: Configure NextCloud Backup
  template:
    src: application.yaml
    dest: /etc/borgmatic.d/{{ application }}_{{ application_id }}.yaml
    mode: 0600
  notify:
    - Init Borgs

- name: Add repo server host key to known hosts
  known_hosts:
    name: '{{ application_remote_host }}'
    key: "{{ application_remote_host }} {{ borgbackup_public_key }}"
    hash_host: no
  ignore_errors: yes
  when: borgbackup_public_key is defined and application_remote_host