ansible-role-nextcloud/tasks/nextcloud.yml

100 lines
3.6 KiB
YAML
Raw Normal View History

2020-12-03 15:52:14 +01:00
---
2020-12-03 23:14:27 +01:00
- name: "NC Verzeichnis prüfen"
2020-12-03 15:52:14 +01:00
file:
path: "{{ nextcloud_install_path }}"
mode: 0755
state: directory
2020-12-03 23:14:27 +01:00
- name: "NC herunterladen und entpacken"
2020-12-03 15:52:14 +01:00
unarchive:
src: "{{ nextcloud_dl_url }}/{{ nextcloud_version }}.tar.bz2"
remote_src: true
extra_opts:
- "--strip-components=1"
dest: "{{ nextcloud_install_path }}"
owner: "{{ user }}"
group: "{{ user }}"
2020-12-03 15:52:14 +01:00
mode: 0755
2020-12-03 23:14:27 +01:00
- name: "NC Installation"
2020-12-03 15:52:14 +01:00
command: >
php "{{ nextcloud_install_path }}"/occ maintenance:install --database "mysql"
--database-name "{{ database }}" --database-user "{{ database }}"
--database-pass "{{ lookup('password', '/tmp/nc_db_password chars=ascii_letters') }}" --database-host "{{ database_host }}"
2020-12-03 15:52:14 +01:00
--admin-user "{{ nextcloud_admin_user }}" --admin-pass "{{ nextcloud_admin_pw }}"
become: true
become_user: "{{ user }}"
2020-12-03 15:52:14 +01:00
changed_when: true
#todo: Auch auf instances.alias anwenden
2021-04-02 10:39:01 +02:00
- name: "NC trusted domains einrichten"
2020-12-03 15:52:14 +01:00
command: 'php {{ nextcloud_install_path }}/occ config:system:set trusted_domains {{ item.0 }} --value "{{ item.1 }}"'
become: true
become_user: "{{ name }}"
2020-12-03 15:52:14 +01:00
changed_when: true
with_indexed_items:
- '{{ nextcloud_trusted_domains }}'
2020-12-03 23:14:27 +01:00
- name: "NC cron einrichten"
cron:
name: "nextcloud {{ domain }}"
2020-12-03 23:14:27 +01:00
minute: "*/5"
user: "{{ user }}"
2020-12-03 23:14:27 +01:00
job: "php -f {{ nextcloud_install_path}}/cron.php"
cron_file: "nextcloud"
- name: "NC allgemeie Konfiguration"
command: "{{ item }}"
become: true
become_user: "{{ user }}"
2020-12-03 23:14:27 +01:00
changed_when: true
with_items:
- "php {{ nextcloud_install_path }}/occ app:enable encryption"
- "php {{ nextcloud_install_path }}/occ encryption:enable"
- 'php {{ nextcloud_install_path }}/occ config:system:set memcache.local --value "\\OC\\Memcache\\APCu"'
2020-12-03 23:54:55 +01:00
- 'php {{ nextcloud_install_path }}/occ config:system:set memcache.distributed --value "\OC\Memcache\Redis"'
2020-12-03 23:14:27 +01:00
- "php {{ nextcloud_install_path }}/occ background:cron"
- 'php {{ nextcloud_install_path }}/occ config:system:set overwrite.cli.url --value https://{{ domain }}'
2020-12-03 23:14:27 +01:00
- 'php {{ nextcloud_install_path }}/occ config:system:set htaccess.RewriteBase --value /'
2020-12-03 23:54:55 +01:00
- 'php {{ nextcloud_install_path }}/occ maintenance:update:htaccess'
2020-12-08 12:20:06 +01:00
- 'php {{ nextcloud_install_path }}/occ config:system:set default_language --value "de"'
2021-04-16 12:54:01 +02:00
- 'php {{ nextcloud_install_path }}/occ config:system:set default_phone_region --value "DE"'
- 'php {{ nextcloud_install_path }}/occ config:system:set loglevel --value "1"'
2020-12-03 23:14:27 +01:00
- name: "NC Mailversand einrichten"
blockinfile:
path: "{{ nextcloud_config_file }}"
insertbefore: '^\);'
marker_begin: mailserver
block: |2
'mail_from_address' => '{{ nextcloud_mail_from }}',
'mail_smtpmode' => 'smtp',
'mail_sendmailmode' => 'smtp',
'mail_domain' => '{{ nextcloud_mail_domain }}',
'mail_smtpauthtype' => '{{ nextcloud_smtp_auth_type }}',
'mail_smtphost' => '{{ nextcloud_smtp_host }}',
'mail_smtpport' => '{{ nextcloud_smtp_port}}',
2020-12-03 23:54:55 +01:00
- name: "NC Filelocking"
blockinfile:
path: "{{ nextcloud_config_file }}"
insertbefore: '^\);'
marker_begin: filelocking
block: |2
'filelocking.enabled' => true,
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
'host' => '/var/run/redis/redis-server.sock',
'port' => 0,
'timeout' => 0.0,
),
- name: "NC trusted proxies einrichten"
2020-12-03 23:14:27 +01:00
command: 'php {{ nextcloud_install_path }}/occ config:system:set trusted_proxies {{ item.0 }} --value "{{ item.1 }}"'
become: true
become_user: "{{ user }}"
2020-12-03 23:14:27 +01:00
changed_when: true
with_indexed_items:
2020-12-03 23:54:55 +01:00
- '{{ nextcloud_trusted_proxies }}'