diff --git a/defaults/main.yml b/defaults/main.yml index 68f96c6..f0afc5a 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -2,22 +2,13 @@ nextcloud_admin_user: systemausfall.org nextcloud_admin_pw: admin nextcloud_db_password: "{{ lookup('password', '/tmp/{{ instance.name }}_db_pwd length=42 chars=ascii_letters,digits') }}" -nextcloud_dl_url: https://download.nextcloud.com/server/releases +nextcloud_github_api_url: https://api.github.com/repos/nextcloud/server/releases/latest +nextcloud_dl_url: "https://download.nextcloud.com/server/releases/nextcloud-{{ latest_version.stdout }}.tar.bz2" nextcloud_root: /data/nextcloud nextcloud_install_path: "{{ nextcloud_root }}/{{ instance.name }}" nextcloud_config_file: "{{ nextcloud_install_path }}/config/config.php" nextcloud_php_memory_limit: 512M nextcloud_php_upload_limit: 512M nextcloud_trusted_domains: ['localhost', '{{ instance.name }}'] -nextcloud_trusted_proxies: ['10.42.7.1'] -nextcloud_version: nextcloud-22.2.0 -nextcloud_mail_from: noreply -nextcloud_mail_domain: postfach.senselab.org -nextcloud_smtp_auth_type: LOGIN -nextcloud_smtp_host: sl-postbote.kahlo -nextcloud_smtp_port: 25 - -php_fpm_log_dir: /var/log/phpfpm -php_fpm_pool_dir: /etc/php/{{ php_version.stdout }}/fpm/pool.d redis_config_file: /etc/redis/redis.conf diff --git a/tasks/common.yml b/tasks/common.yml index 06d0d17..29fbcdd 100644 --- a/tasks/common.yml +++ b/tasks/common.yml @@ -8,15 +8,20 @@ - { name: expires } - { name: headers } - { name: macro } - - { name: mpm_prefork, state: absent } - { name: mpm_event } + - { name: mpm_prefork, state: absent } - { name: proxy_fcgi } - { name: setenvif } notify: restart apache +- name: "common | Apache-Konfiguration für NC-Seiten" + file: + path: /etc/apache2/conf-available/nextcloud_sites.conf + state: touch + - name: "common | Apache-Vorlage für Seitenkonfiguration kopieren" - copy: - src: ../roles/nextcloud/files/apache_site.conf + template: + src: ../roles/nextcloud/templates/apache_site.conf.j2 dest: /etc/apache2/sites-available/nextcloud.conf - name: "common | Apache-Seitenkonfiguration aktivieren" @@ -37,6 +42,13 @@ dest: "/etc/php/{{ php_version.stdout }}/cli/conf.d/30-sao-nextcloud.ini" state: link +- name: "common | Ermittle letzte Version" + shell: + cmd: curl -sL "{{ nextcloud_github_api_url }}" | jq -r ".tag_name" | cut -d 'v' -f2 + warn: false + changed_when: false + register: latest_version + - name: "common | Kopiere Update-Skript" template: src: ../roles/nextcloud/templates/nextcloud-updater.j2 diff --git a/tasks/database.yml b/tasks/database.yml index 173493a..71e9301 100644 --- a/tasks/database.yml +++ b/tasks/database.yml @@ -5,7 +5,6 @@ state: present login_unix_socket: "{{ mysql_socket }}" login_user: root - config_file: /etc/mysql/debian.cnf delegate_to: "{{ database_host }}" - name: "database | {{ instance.name }} | Benutzer einrichten" diff --git a/tasks/nextcloud.yml b/tasks/nextcloud.yml index b7bff04..26e65d8 100644 --- a/tasks/nextcloud.yml +++ b/tasks/nextcloud.yml @@ -7,21 +7,23 @@ - name: "nextcloud: {{ instance.name }}: herunterladen und entpacken" unarchive: - src: "{{ nextcloud_dl_url }}/{{ nextcloud_version }}.tar.bz2" + src: "{{ nextcloud_dl_url }}" remote_src: true extra_opts: - "--strip-components=1" dest: "{{ nextcloud_install_path }}" - owner: "{{ user }}" - group: "{{ user }}" + owner: "{{ instance.user }}" + group: "{{ instance.user }}" mode: 0755 - name: "nextcloud: {{ instance.name }}: Installation" - command: > - php "{{ nextcloud_install_path }}"/occ maintenance:install --database "mysql" - --database-name "{{ instance.database }}" --database-user "{{ instance.database }}" - --database-pass "{{ nextcloud_db_password }}" --database-host "{{ database_host }}" - --admin-user "{{ nextcloud_admin_user }}" --admin-pass "{{ nextcloud_admin_pw }}" + command: + cmd: > + php occ maintenance:install --database "mysql" + --database-name "{{ instance.database }}" --database-user "{{ instance.database }}" + --database-pass "{{ nextcloud_db_password }}" --database-host "{{ database_host }}" + --admin-user "{{ nextcloud_admin_user }}" --admin-pass "{{ nextcloud_admin_pw }}" + chdir: "{{ nextcloud_install_path }}" become: true become_user: "{{ instance.user }}" changed_when: true diff --git a/files/apache_site.conf b/templates/apache_site.conf.j2 similarity index 95% rename from files/apache_site.conf rename to templates/apache_site.conf.j2 index 6db0a57..edce610 100644 --- a/files/apache_site.conf +++ b/templates/apache_site.conf.j2 @@ -19,7 +19,7 @@ - + Require all granted AllowOverride All Options FollowSymLinks MultiViews