--- - name: Add repo.s3lph.me key ansible.builtin.apt_key: url: https://repo.s3lph.me/debian/repo.s3lph.me.gpg keyring: /etc/apt/trusted.gpg.d/repo.s3lph.me.gpg - name: Add repo.s3lph.me ansible.builtin.apt_repository: filename: repo.s3lph.me.list repo: deb https://repo.s3lph.me/debian stable main - name: Install apache2 ansible.builtin.apt: name: apache2 - name: Install Nextcloud package ansible.builtin.apt: 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: trusted_domains: "{{ nextcloud_trusted_domains }}" cli_baseurl: "{{ nextcloud_cli_baseurl }}" redis: host: "{{ nextcloud_redis_host }}" port: "{{ nextcloud_redis_port }}" dbindex: "{{ nextcloud_redis_dbindex }}" timeout: "{{ nextcloud_redis_timeout }}" 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 }}"