---
# This playbook deploys the cloudbox on a minimal installation.

- name: apply configuration to the cloudbox
  hosts: cloudboxes
  remote_user: ansible
  become: Yes
  vars:
    if_lan: "enp1s0"
    ipaddr: "192.168.2.50/24"
    gateway: "192.168.2.1"
    DNS: "192.168.2.1"
    ddns_domain: "something.ddnss.de"
    ddns_updkey: "138638.some.key.here.635620"
    ## 'nc_download' and 'nc_checksum' are only
    ## used for ansible-pull during installation:
    nc_download: "https://download.nextcloud.com/server/releases/latest.tar.bz2"
    nc_checksum: "sha256:770faf34b8f0d81273623daed4d64ec7919c38dfeb07328b613058addbed19c0"
    nc_apps:
      - calendar
      - notes
    backup_opts: "--exclude-caches -e '*/updater-*/' -e '*/preview/*' -e '*/files_trashbin/*'"
    backup_dirs:
      - "/etc"
      - "{{ nc_dir }}"
      - "{{ data_dir }}"
    ansible_python_interpreter: "/usr/bin/python3"

  roles:
    - up2date-debian
#    - ddns-update
#    - low-power
    - nextcloud
    - nextcloud-upgrade
    - backup


## Hosts in the the 'only_nextcloud'-group are only upgraded: 

- name: upgrade nextcloud only
  hosts: only_nextcloud
  remote_user: ansible
  become: Yes
  vars:
    nc_dir: "/var/www/nextcloud" 
    nc_apps:
      - calendar
      - notes
    ansible_python_interpreter: "/usr/bin/python3"

  roles:
    - up2date-debian
    - nextcloud-upgrade