diff --git a/tasks/main.yml b/tasks/main.yml index ca6b169..9c03daf 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -5,8 +5,10 @@ - import_tasks: php.yml - import_tasks: apache.yml -- name: "Nextcloud einrichten" +- name: "Nextcloud installieren" include_tasks: nextcloud.yml when: nc_is_installed.stat.exists == False +- import_tasks: nextcloud_configuration.yml + tags: configuration - import_tasks: fixes.yml diff --git a/tasks/nextcloud_configuration.yml b/tasks/nextcloud_configuration.yml new file mode 100644 index 0000000..f7d4e95 --- /dev/null +++ b/tasks/nextcloud_configuration.yml @@ -0,0 +1,70 @@ +--- +#todo: Auch auf instances.alias anwenden +- name: "configuration: {{ instance.domain }}: trusted domains einrichten" + command: 'php {{ nextcloud_install_path }}/occ config:system:set trusted_domains {{ item.0 }} --value "{{ item.1 }}"' + become: true + become_user: "{{ instance.user }}" + changed_when: true + with_indexed_items: + - '{{ nextcloud_trusted_domains }}' + +- name: "configuration: {{ instance.domain }}: cron einrichten" + cron: + name: "nextcloud {{ instance.domain }}" + minute: "*/5" + user: "{{ instance.user }}" + job: "php -f {{ nextcloud_install_path}}/cron.php" + cron_file: "nextcloud" + +- name: "configuration: {{ instance.domain }}: allgemeie Konfiguration" + command: "{{ item }}" + become: true + become_user: "{{ instance.user }}" + changed_when: true + with_items: + - 'php {{ nextcloud_install_path }}/occ config:system:set memcache.local --value "\\OC\\Memcache\\APCu"' + - 'php {{ nextcloud_install_path }}/occ config:system:set memcache.distributed --value "\OC\Memcache\Redis"' + - "php {{ nextcloud_install_path }}/occ background:cron" + - 'php {{ nextcloud_install_path }}/occ config:system:set overwrite.cli.url --value https://{{ instance.domain }}' + - 'php {{ nextcloud_install_path }}/occ config:system:set htaccess.RewriteBase --value /' + - 'php {{ nextcloud_install_path }}/occ maintenance:update:htaccess' + - 'php {{ nextcloud_install_path }}/occ config:system:set default_language --value "de"' + - 'php {{ nextcloud_install_path }}/occ config:system:set default_phone_region --value "DE"' + - 'php {{ nextcloud_install_path }}/occ config:system:set loglevel --value "1"' + +- name: "configuration: {{ instance.domain }}: 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}}', + +- name: "configuration: {{ instance.domain }}: 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, + 'dbindex' => {{ instance_id }}, + 'timeout' => 1.5, + ), + +- name: "configuration: {{ instance.domain }}: trusted proxies einrichten" + command: 'php {{ nextcloud_install_path }}/occ config:system:set trusted_proxies {{ item.0 }} --value "{{ item.1 }}"' + become: true + become_user: "{{ instance.user }}" + changed_when: true + with_indexed_items: + - "{{ nextcloud_trusted_proxies }}"