ansible-role-nextcloud/tasks/nextcloud.yml

62 lines
2.2 KiB
YAML
Raw Normal View History

2020-12-03 15:52:14 +01: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
when: not nc_is_installed.stat.exists
2020-12-03 15:52:14 +01:00
- name: "Nextcloud | Lade Archiv herunter | {{ item.name }}"
ansible.builtin.unarchive:
src: "{{ nextcloud_dl_url }}"
2020-12-03 15:52:14 +01:00
remote_src: true
extra_opts:
- "--strip-components=1"
dest: "{{ nextcloud_install_path }}"
owner: "{{ item.user }}"
group: "{{ item.user }}"
when: not nc_is_installed.stat.exists
2020-12-03 15:52:14 +01:00
- name: "Nextcloud | Führe Installation aus | {{ item.name }}"
ansible.builtin.command:
cmd: >
php occ maintenance:install --database "mysql"
--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 }}"
2020-12-03 15:52:14 +01:00
become: true
become_user: "{{ item.user }}"
2020-12-03 15:52:14 +01:00
changed_when: true
2024-03-23 23:10:01 +01:00
when: not nc_is_installed.stat.exists and item.database_type == "mariadb"
2023-10-25 17:44:18 +02:00
- 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 }}"
2024-03-23 23:10:01 +01:00
when: not nc_is_installed.stat.exists and item.database_type == "postgresql"