- name: install nextcloud unarchive: src: "https://download.nextcloud.com/server/releases/latest.tar.bz2" remote_src: yes dest: /var/www/ owner: www-data group: www-data creates: /var/www/nextcloud - name: create nextcloud datadir file: path: "{{ nextcloud.datadir }}" owner: www-data group: www-data mode: 0770 state: directory - name: ensure apc is used on the cli as well copy: dest: "/etc/php/{{ php_version }}/cli/conf.d/enable-apc-cli.ini" owner: root group: root mode: 0644 content: | apc.enable_cli = 1 - name: setup nextcloud become_user: www-data become: true command: "/usr/bin/php occ maintenance:install -n --database 'mysql' --database-name '{{ nextcloud.db.name }}' --database-user '{{ nextcloud.db.user }}' --database-pass '{{ nextcloud.db.pw }}' --admin-user '{{ nextcloud.admin.name }}' --admin-pass '{{ nextcloud.admin.pw }}' --data-dir '{{ nextcloud.datadir }}'" args: chdir: /var/www/nextcloud creates: /var/www/nextcloud/config/config.php - name: set nextcloud trusted domains become_user: www-data become: true command: '/usr/bin/php occ config:system:set trusted_domains 1 --value "{{ nextcloud.externalurl }}"' args: chdir: /var/www/nextcloud - name: set other nextcloud config values become_user: www-data become: true command: '/usr/bin/php occ config:system:set "{{ item.key }}" --value "{{ item.value }}"' args: chdir: /var/www/nextcloud with_items: - { key: "mail_from_address", value: "{{ nextcloud.mail.from }}" } - { key: "mail_domain", value: "{{ nextcloud.mail.domain }}" } - { key: "mail_smtpmode", value: "{{ nextcloud.mail.mode }}" } - { key: "mail_smtpauthtype", value: "PLAIN" } - { key: "mail_smtphost", value: "{{ nextcloud.mail.server|d('') }}" } - { key: "mail_smtpport", value: "25" } - { key: "mail_smtppassword", value: "{{ nextcloud.mail.password|d('') }}" } - { key: "mail_smtpname", value: "{{ nextcloud.mail.user|d('') }}" } - { key: "memcache.local", value: '{{ "\OC\Memcache\APCu" }}' } - { key: "datadirectory", value: "{{ nextcloud.datadir }}" } - { key: "defaultapp", value: "files" } - { key: "default_phone_region", value: "DE" } - name: copy nextcloud nginx config template: src: nginx.j2 dest: /etc/nginx/sites-available/nextcloud notify: - restart nginx - name: enable nextcloud for nginx file: src: /etc/nginx/sites-available/nextcloud dest: /etc/nginx/sites-enabled/nextcloud state: link notify: - restart nginx - name: add cronjob for nextcloud cron: job: /usr/bin/php -f /var/www/nextcloud/cron.php user: www-data minute: "*/10" name: nextcloud-cron - name: add preview cronjob for nextcloud cron: job: /usr/bin/php -f /var/www/nextcloud/occ preview:pre-generate user: www-data minute: "17,47" name: nextcloud-preview-generate