ansible-role-nextcloud/tasks/nextcloud.yml
2024-03-23 23:10:01 +01:00

61 lines
2.2 KiB
YAML

---
- 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:
path: "{{ nextcloud_install_path }}"
mode: "0755"
state: directory
when: not nc_is_installed.stat.exists
- name: "Nextcloud | Lade Archiv herunter | {{ item.name }}"
ansible.builtin.unarchive:
src: "{{ nextcloud_dl_url }}"
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
- 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 }}"
become: true
become_user: "{{ item.user }}"
changed_when: true
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"