--- - name: Add repo.s3lph.me ansible.builtin.apt: deb: https://git.kabelsalat.ch/s3lph/-/packages/debian/repo.s3lph.me-apt-source/0.2-2/files/3003 - name: Install apache2 ansible.builtin.apt: name: apache2 - name: Install Nextcloud package ansible.builtin.apt: update_cache: true name: "nextcloud-{{ nextcloud_major_version }}" - name: Gather Nextcloud facts become: true become_user: www-data s3lph.nextcloud.nextcloud_facts: webroot: /var/lib/nextcloud/webroot - name: Initialize MariaDB database if Nextcloud is not installed yet when: - not ansible_facts.nextcloud_status.installed - nextcloud_db_engine == 'mysql' - nextcloud_db_host == 'localhost' block: - name: Install MariaDB server ansible.builtin.apt: name: mariadb-server - name: Create MariaDB Database community.mysql.mysql_db: name: '{{ nextcloud_db_name }}' login_unix_socket: /run/mysqld/mysqld.sock check_implicit_admin: true - name: Create nextcloud database user community.mysql.mysql_user: name: "{{ nextcloud_db_user }}" host: "localhost" password: "{{ nextcloud_db_pass }}" priv: "{{ nextcloud_db_name }}.*:ALL" # grant all privileges (no grant) login_unix_socket: /run/mysqld/mysqld.sock check_implicit_admin: true - name: Perform Nextcloud first-time setup become: true become_user: www-data s3lph.nextcloud.install: webroot: /var/lib/nextcloud/webroot data_dir: /var/lib/nextcloud/data database: "{{ nextcloud_db_engine }}" database_host: "{{ nextcloud_db_host | default(omit) }}" database_port: "{{ nextcloud_db_port | default(omit) }}" database_user: "{{ nextcloud_db_user | default(omit) }}" database_pass: "{{ nextcloud_db_pass | default(omit) }}" database_name: "{{ nextcloud_db_name | default(omit) }}" database_table_space: "{{ nextcloud_db_table_space | default(omit) }}" admin_user: "{{ nextcloud_admin_user | default(omit) }}" admin_pass: "{{ nextcloud_admin_pass }}" admin_email: "{{ nextcloud_admin_email | default(omit) }}" register: nextcloud_register_installation - name: Gather Nextcloud facts after completing the installation become: true become_user: www-data s3lph.nextcloud.nextcloud_facts: webroot: /var/lib/nextcloud/webroot when: nextcloud_register_installation.changed - name: Set common Nextcloud options become: true become_user: www-data s3lph.nextcloud.config: webroot: /var/lib/nextcloud/webroot system: redis: host: "{{ nextcloud_redis_host }}" port: "{{ nextcloud_redis_port }}" dbindex: "{{ nextcloud_redis_dbindex }}" timeout: "{{ nextcloud_redis_timeout }}" - name: Set common Nextcloud options become: true become_user: www-data s3lph.nextcloud.config: webroot: /var/lib/nextcloud/webroot system: trusted_domains: "{{ nextcloud_trusted_domains }}" cli_baseurl: "{{ nextcloud_cli_baseurl }}" memcache.local: '\OC\Memcache\Redis' memcache.distributed: '\OC\Memcache\Redis' memcache.locking: '\OC\Memcache\Redis' mysql.utf8mb4: true - name: Install Nextcloud app packages become: true become_user: www-data ansible.builtin.apt: name: "{{ nextcloud_app_packages }}"