2020-12-03 15:52:14 +01:00
|
|
|
---
|
2023-05-21 23:01:31 +02:00
|
|
|
- name: "Nextcloud | Prüfe NC-Installation | {{ item.name }}"
|
|
|
|
ansible.builtin.stat:
|
|
|
|
path: "{{ nextcloud_install_path }}/version.php"
|
|
|
|
register: nc_is_installed
|
|
|
|
check_mode: false
|
|
|
|
changed_when: false
|
|
|
|
|
|
|
|
- name: "Nextcloud | Prüfe NC-Version | {{ item.name }}"
|
|
|
|
ansible.builtin.shell:
|
|
|
|
cmd: php ./occ -V | awk '{print $NF}'
|
|
|
|
chdir: "{{ nextcloud_install_path }}"
|
|
|
|
become: true
|
|
|
|
become_user: "{{ item.user }}"
|
|
|
|
register: nc_installed_version
|
|
|
|
when: nc_is_installed.stat.exists
|
|
|
|
check_mode: false
|
|
|
|
changed_when: false
|
|
|
|
|
|
|
|
- name: "Nextcloud | Prüfe Installationsverzeichnis | {{ item.name }}"
|
|
|
|
ansible.builtin.file:
|
2020-12-03 15:52:14 +01:00
|
|
|
path: "{{ nextcloud_install_path }}"
|
2023-10-25 19:31:25 +02:00
|
|
|
mode: "0755"
|
2020-12-03 15:52:14 +01:00
|
|
|
state: directory
|
2023-05-21 23:01:31 +02:00
|
|
|
when: not nc_is_installed.stat.exists
|
2020-12-03 15:52:14 +01:00
|
|
|
|
2023-05-21 23:01:31 +02:00
|
|
|
- name: "Nextcloud | Lade Archiv herunter | {{ item.name }}"
|
|
|
|
ansible.builtin.unarchive:
|
2022-10-08 22:47:54 +02:00
|
|
|
src: "{{ nextcloud_dl_url }}"
|
2020-12-03 15:52:14 +01:00
|
|
|
remote_src: true
|
|
|
|
extra_opts:
|
|
|
|
- "--strip-components=1"
|
|
|
|
dest: "{{ nextcloud_install_path }}"
|
2023-05-21 23:01:31 +02:00
|
|
|
owner: "{{ item.user }}"
|
|
|
|
group: "{{ item.user }}"
|
|
|
|
mode: "0644"
|
|
|
|
when: not nc_is_installed.stat.exists
|
2020-12-03 15:52:14 +01:00
|
|
|
|
2023-05-21 23:01:31 +02:00
|
|
|
- name: "Nextcloud | Führe Installation aus | {{ item.name }}"
|
|
|
|
ansible.builtin.command:
|
2022-10-08 22:47:54 +02:00
|
|
|
cmd: >
|
|
|
|
php occ maintenance:install --database "mysql"
|
2023-05-21 23:01:31 +02:00
|
|
|
--database-name "{{ item.database }}" --database-user "{{ item.database }}"
|
2022-10-08 22:47:54 +02:00
|
|
|
--database-pass "{{ nextcloud_db_password }}" --database-host "{{ database_host }}"
|
|
|
|
--admin-user "{{ nextcloud_admin_user }}" --admin-pass "{{ nextcloud_admin_pw }}"
|
|
|
|
chdir: "{{ nextcloud_install_path }}"
|
2020-12-03 15:52:14 +01:00
|
|
|
become: true
|
2023-05-21 23:01:31 +02:00
|
|
|
become_user: "{{ item.user }}"
|
2020-12-03 15:52:14 +01:00
|
|
|
changed_when: true
|
2023-10-25 17:44:18 +02:00
|
|
|
when: not nc_is_installed.stat.exists and item.database_type == "MariaDB"
|
|
|
|
|
|
|
|
- name: "Nextcloud | Führe Installation aus | {{ item.name }}"
|
|
|
|
ansible.builtin.command:
|
|
|
|
cmd: >
|
|
|
|
php occ maintenance:install --database "pgsql"
|
|
|
|
--database-name "{{ item.database }}" --database-user "{{ item.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: "{{ item.user }}"
|
|
|
|
when: not nc_is_installed.stat.exists and item.database_type == "PostgreSQL"
|