diff --git a/defaults/main.yml b/defaults/main.yml index a2ccce73e4d92ccdff283b759dcde71fe15c9bb4..d36cc6140cf29791d93c1cf39d29e2b05e97ffd3 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,3 +1,5 @@ +--- + nextcloud_version: 16.0.1 nextcloud_plugins: - announcementcenter diff --git a/tasks/apache.yml b/tasks/apache.yml index 47e4d24bf681cbc29d3195acdc11493c52ea7665..994ec527381113f9480002ab7c95d4df6e3b7b18 100644 --- a/tasks/apache.yml +++ b/tasks/apache.yml @@ -25,7 +25,7 @@ - name: Apache enable our new site(s) command: a2ensite nextcloud-{{ nextcloud.id }} - args + args: creates: /etc/apache2/sites-enabled/nextcloud-{{ nextcloud.id }}{{ apache_conf_ext }} notify: - Restart Apache diff --git a/tasks/install.yml b/tasks/install.yml index bc8f3cd59a092a6ac2adee5c713ed2131638b795..831e32f532bf6cf9375c5587e5097efab30c7cd4 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -2,20 +2,20 @@ # file: roles/nextcloud/tasks/install.yml - block: - - set_fact: - installed: '{{ nextcloud.config.instanceid != "" }}' - - set_fact: - webRoot: /var/www/nextcloud/{{ nextcloud.id }} - dataRoot: '{{ nextcloud_data_dir|default("/var/www/nextcloud/_data") }}/{{ nextcloud.id }}' - apacheUser: www-data - apacheLogDir: /var/log/apache2 - when: nextcloud.jail is not defined - - set_fact: - webRoot: '{{ jailroot }}/{{ nextcloud.id }}/var/www/nextcloud' - dataRoot: '{{ jailroot }}/{{ nextcloud.id }}/var/www/datanextcloud' - apacheUser: '{{ nextcloud.id }}' - apacheLogDir: '{{ jailroot }}/{{ nextcloud.id }}/var/log/apache2' - when: nextcloud.jail is defined + - set_fact: + installed: '{{ nextcloud.config.instanceid != "" }}' + - set_fact: + webRoot: /var/www/nextcloud/{{ nextcloud.id }} + dataRoot: '{{ nextcloud_data_dir|default("/var/www/nextcloud/_data") }}/{{ nextcloud.id }}' + apacheUser: www-data + apacheLogDir: /var/log/apache2 + when: nextcloud.jail is not defined + - set_fact: + webRoot: '{{ jailroot }}/{{ nextcloud.id }}/var/www/nextcloud' + dataRoot: '{{ jailroot }}/{{ nextcloud.id }}/var/www/datanextcloud' + apacheUser: '{{ nextcloud.id }}' + apacheLogDir: '{{ jailroot }}/{{ nextcloud.id }}/var/log/apache2' + when: nextcloud.jail is defined tags: - always @@ -211,33 +211,33 @@ - block: - - name: Enable Plugins - command: '{{ webRoot }}/occ app:enable {{ item.id }} --no-interaction --no-warnings' - become_user: '{{ apacheUser }}' - ignore_errors: yes - with_items: '{{ nextcloud_plugins_public }}' - when: item.latest_release.version != plugin_versions[item.id]|default('0.0.0') - tags: - - deploy - - plugins - - - name: Run Upgrade - command: '{{ webRoot }}/occ upgrade --no-interaction --no-warnings' - become_user: '{{ apacheUser }}' - ignore_errors: yes - tags: - - deploy - - plugins - - - name: Enable Plugins - command: '{{ webRoot }}/occ app:enable {{ item.id }} --no-interaction --no-warnings' - become_user: '{{ apacheUser }}' - ignore_errors: yes - with_items: '{{ nextcloud_plugins_public }}' - when: item.latest_release.version != plugin_versions[item.id]|default('0.0.0') - tags: - - deploy - - plugins + - name: Enable Plugins + command: '{{ webRoot }}/occ app:enable {{ item.id }} --no-interaction --no-warnings' + become_user: '{{ apacheUser }}' + ignore_errors: yes + with_items: '{{ nextcloud_plugins_public }}' + when: item.latest_release.version != plugin_versions[item.id]|default('0.0.0') + tags: + - deploy + - plugins + + - name: Run Upgrade + command: '{{ webRoot }}/occ upgrade --no-interaction --no-warnings' + become_user: '{{ apacheUser }}' + ignore_errors: yes + tags: + - deploy + - plugins + + - name: Enable Plugins + command: '{{ webRoot }}/occ app:enable {{ item.id }} --no-interaction --no-warnings' + become_user: '{{ apacheUser }}' + ignore_errors: yes + with_items: '{{ nextcloud_plugins_public }}' + when: item.latest_release.version != plugin_versions[item.id]|default('0.0.0') + tags: + - deploy + - plugins when: installed diff --git a/tasks/main.yml b/tasks/main.yml index 81eed01511a6c06154b3cbed605f84f219d185b5..8c966e633c4b60cd76826e822466b7cf3c9827e0 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -8,95 +8,95 @@ - always - block: - - name: Install Certs - include_tasks: ../../letsencrypt/tasks/cert.yml - with_items: '{{ nextcloud_settings|default([]) }}' - loop_control: - loop_var: domain - when: domain.protocol|default("https") == "https" and domain.letsencrypt|default(true) + - name: Install Certs + include_tasks: ../../letsencrypt/tasks/cert.yml + with_items: '{{ nextcloud_settings|default([]) }}' + loop_control: + loop_var: domain + when: domain.protocol|default("https") == "https" and domain.letsencrypt|default(true) when: not excluded_roles or "letsencrypt" not in excluded_roles and groups.proxyserver is not defined - block: - - name: Ensure Download Directory - file: - path: /opt/nextcloud-downloads - state: directory - tags: - - always + - name: Ensure Download Directory + file: + path: /opt/nextcloud-downloads + state: directory + tags: + - always - - name: List Downlaods - shell: ls /opt/nextcloud-downloads -1 - register: download_list - tags: - - always + - name: List Downlaods + shell: ls /opt/nextcloud-downloads -1 + register: download_list + tags: + - always - - name: Lookup Plugins - set_fact: - nextcloud_plugins_public: '{{ lookup("nextcloud_plugins", "{{ nextcloud_version }}") }}' - run_once: true - delegate_to: localhost - tags: - - always + - name: Lookup Plugins + set_fact: + nextcloud_plugins_public: '{{ lookup("nextcloud_plugins", "{{ nextcloud_version }}") }}' + run_once: yes + delegate_to: localhost + tags: + - always - - name: Download Archive - get_url: - url: https://download.nextcloud.com/server/releases/nextcloud-{{ nextcloud_version }}.zip - dest: /opt/nextcloud-downloads/nextcloud-{{ nextcloud_version }}.zip - when: download_list and ['nextcloud-', nextcloud_version, '.zip']|join('') not in download_list.stdout_lines - tags: - - deploy + - name: Download Archive + get_url: + url: https://download.nextcloud.com/server/releases/nextcloud-{{ nextcloud_version }}.zip + dest: /opt/nextcloud-downloads/nextcloud-{{ nextcloud_version }}.zip + when: download_list and ['nextcloud-', nextcloud_version, '.zip']|join('') not in download_list.stdout_lines + tags: + - deploy - - name: Download Plugins - get_url: - url: '{{ item.latest_release.download }}' - dest: /opt/nextcloud-downloads/{{ item.id }}-{{ item.latest_release.version }}.tar.gz - with_items: '{{ nextcloud_plugins_public }}' - when: item.needs_download - tags: - - deploy - - plugins + - name: Download Plugins + get_url: + url: '{{ item.latest_release.download }}' + dest: /opt/nextcloud-downloads/{{ item.id }}-{{ item.latest_release.version }}.tar.gz + with_items: '{{ nextcloud_plugins_public }}' + when: item.needs_download + tags: + - deploy + - plugins - - name: Ensure Log Directory - file: - path: /var/log/nextcloud - state: directory - owner: www-data - group: www-data - mode: 0775 - tags: - - ApacheConfig + - name: Ensure Log Directory + file: + path: /var/log/nextcloud + state: directory + owner: www-data + group: www-data + mode: 0775 + tags: + - ApacheConfig - - name: Install logrotate script - template: - src: etc-logrotate-nextcloud - dest: /etc/logrotate.d/nextcloud - owner: root - group: root - mode: 0644 - tags: - - ApacheConfig - - logrotate + - name: Install logrotate script + template: + src: etc-logrotate-nextcloud + dest: /etc/logrotate.d/nextcloud + owner: root + group: root + mode: 0644 + tags: + - ApacheConfig + - logrotate - - name: Install NextCloud - include_tasks: install.yml - with_items: '{{ nextcloud_settings|default([]) }}' - loop_control: - loop_var: nextcloud - when: limit_site is not defined or limit_site == 'no' or nextcloud.id is not defined or limit_site == nextcloud.id - tags: - - ApacheConfig - - cron - - deploy - - plugins + - name: Install NextCloud + include_tasks: install.yml + with_items: '{{ nextcloud_settings|default([]) }}' + loop_control: + loop_var: nextcloud + when: limit_site is not defined or limit_site == 'no' or nextcloud.id is not defined or limit_site == nextcloud.id + tags: + - ApacheConfig + - cron + - deploy + - plugins - - name: Install Collabora server - include_tasks: collabora.yml + - name: Install Collabora server + include_tasks: collabora.yml - - name: Install TURN server - include_tasks: turn.yml + - name: Install TURN server + include_tasks: turn.yml - - name: Install tesseract - include_tasks: tesseract.yml + - name: Install tesseract + include_tasks: tesseract.yml when: not excluded_roles or "nextcloud" not in excluded_roles