Added set of tasks configuring Nextcloud after installation

This commit is contained in:
2025-11-18 21:29:25 -05:00
parent de70d3bdd3
commit 870b16582c

View File

@@ -8,57 +8,61 @@
- name: Enable monitoring of network hardware - name: Enable monitoring of network hardware
ansible.builtin.command: ansible.builtin.command:
cmd: "snap connect nextcloud:network-observe" cmd: "snap connect nextcloud:network-observe"
- name: Enable access to removable media - name: Begin manual installation
ansible.builtin.command: ansible.builtin.command:
cmd: "snap connect nextcloud:removable-media" argv:
- /snap/bin/nextcloud.manual-install
- "{{ config.nextcloud.users.admin.username }}"
- "{{ config.nextcloud.users.admin.password }}"
# @TODO see if setting below is necessary given use of reverse proxy # @TODO see if setting below is necessary given use of reverse proxy
# - name: Set trusted domains - name: Set trusted domains
# ansible.builtin.command: block:
# cmd: "nextcloud.occ config:system:set trusted_domains 0 --value='cloud.{{ hostvars[inventory_hostname].fqdn }}'" - name: Set localhost as trusted domain
ansible.builtin.command:
cmd: "/snap/bin//snap/bin/nextcloud.occ config:system:set trusted_domains 0 --value='localhost'"
# @TODO see if setting below is necessary given use of reverse proxy
- name: Set FQDN as trusted domain
ansible.builtin.command:
cmd: "/snap/bin//snap/bin/nextcloud.occ config:system:set trusted_domains 1 --value='cloud.{{ hostvars[inventory_hostname].fqdn }}'"
# @TODO configure perhaps for trusted (reverse) proxy instead of above # @TODO configure perhaps for trusted (reverse) proxy instead of above
- name: Set trusted reverse proxy IPv4 address - name: Set trusted reverse proxy addresses
when: config.trusted_revproxy_ips.ipv4 is None or len(config.trusted_revproxy_ips.ipv4) < 1 block:
ansible.builtin.command: - name: Set trusted reverse proxy IPv4 address based on hostname
argv: when: config.trusted_revproxy_ips.ipv4 is None or len(config.trusted_revproxy_ips.ipv4) < 1
- nextcloud.occ ansible.builtin.command:
- "config:system:set" argv:
- trusted_proxies 0 - /snap/bin/nextcloud.occ
- "--value=$(hostname -I | awk -F ' ' '{ print $1 }')" - "config:system:set"
- name: Set trusted reverse proxy IPv4 address - trusted_proxies 0
when: config.trusted_revproxy_ips.ipv4 is not None and len(config.trusted_revproxy_ips.ipv4) > 0 - "--value=$(hostname -I | awk -F ' ' '{ print $1 }')"
ansible.builtin.command: - name: Set trusted reverse proxy IPv4 address
argv: when: config.trusted_revproxy_ips.ipv4 is not None and len(config.trusted_revproxy_ips.ipv4) > 0
- nextcloud.occ ansible.builtin.command:
- "config:system:set" argv:
- "trusted_proxies {{ idx }}" - /snap/bin/nextcloud.occ
- "--value={{ item }}" - "config:system:set"
loop: "{{ config.trusted_revproxy_ips.ipv4 }}" - "trusted_proxies {{ idx }}"
loop_control: - "--value={{ item }}"
index_var: idx loop: "{{ config.trusted_revproxy_ips.ipv4 }}"
- name: Set trusted reverse proxy IPv6 address loop_control:
when: config.trusted_revproxy_ips.ipv6 is None or len(config.trusted_revproxy_ips.ipv6) < 1 index_var: idx
ansible.builtin.command: - name: Set trusted reverse proxy IPv6 address based on hostname
argv: when: config.trusted_revproxy_ips.ipv6 is None or len(config.trusted_revproxy_ips.ipv6) < 1
- nextcloud.occ ansible.builtin.command:
- "config:system:set" argv:
- trusted_proxies 0 - /snap/bin/nextcloud.occ
- "--value=$(hostname -I | awk -F ' ' '{ print $2 }')" - "config:system:set"
- name: Set trusted reverse proxy IPv6 address - trusted_proxies 1
when: config.trusted_revproxy_ips.ipv6 is not None and len(config.trusted_revproxy_ips.ipv6) > 0 - --value=$(hostname -I | awk -F ' ' '{ print $2 }')
ansible.builtin.command: - name: Set trusted reverse proxy IPv6 address
argv: when: config.trusted_revproxy_ips.ipv6 is not None and len(config.trusted_revproxy_ips.ipv6) > 0
- nextcloud.occ ansible.builtin.command:
- "config:system:set" argv:
- "trusted_proxies {{ idx }}" - /snap/bin/nextcloud.occ
- "--value={{ item }}" - "config:system:set"
loop: "{{ config.trusted_revproxy_ips.ipv6 }}" - "trusted_proxies {{ idx }}"
loop_control: - "--value={{ item }}"
index_var: idx loop: "{{ config.trusted_revproxy_ips.ipv6 }}"
- name: Enable LDAP integration app loop_control:
ansible.builtin.command: index_var: idx
cmd: "nextcloud.occ app:enable user_ldap" # @TODO create system-level bash alias for `/snap/bin/nextcloud.occ` command
# @TODO see if can further configure LDAP in particular: https://docs.nextcloud.com/server/stable/admin_manual/occ_command.html#ldap-commands
- name: Enable contacts' birthday calendar app
ansible.builtin.command:
cmd: "nextcloud.occ dav:sync-birthday-calendar"
# @TODO create system-level bash alias for `nextcloud.occ` command