62 lines
1.9 KiB
YAML
62 lines
1.9 KiB
YAML
- 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: 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 }}'"
|
|
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: "smtp" }
|
|
- { key: "mail_smtpauthtype", value: "PLAIN" }
|
|
- { key: "mail_smtphost", value: "{{ mail.server }}" }
|
|
- { key: "mail_smtpport", value: "25" }
|
|
- { key: "memcache.local", value: '{{ "\OC\Memcache\APCu" }}' }
|
|
|
|
- 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
|
|
|
|
|