diff --git a/README.md b/README.md index 8add19d..6ba94ae 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,8 @@ nextcloud_instances: mail_domain: systemausfall.org ``` -# Neue Nextcloud-Instanz anlegen +# Ausführen der Rolle +## Neue Nextcloud-Instanz anlegen - Trage die Informationen zur neuen Instanz in die entsprechende `host_vars`-Datei unter `nextcloud_instances` ein: | Variable | Wert | Beschreibung | @@ -60,6 +61,13 @@ nextcloud_instances: ``` - Bei der Erstinstallation einer Nextcloud-Instanz gibt die Rolle anschließend die Anmeldeinformationen für den Admin-Zugang aus. +## Tasks einzeln ausführen + +Tasks können auch einzeln ausgeführt werden. Der Tasks `configuration` sollte immer mit `hiddenservice` ausgeführt werden (Reihenfolge ist wichtig): +```Shell +ansible-playbook playbooks/nextcloud.yml --tags configuration,hiddenservice +``` + # Aktualisierung des Cores/ von Apps Mit dem Skript `nextcloud-updater` können alle Nextcloud-Instanzen und die installierten Apps gleichzeitig aktualisiert werden. diff --git a/tasks/configuration.yml b/tasks/configuration.yml index dde0952..47c8719 100644 --- a/tasks/configuration.yml +++ b/tasks/configuration.yml @@ -25,10 +25,10 @@ dest: "/tmp/{{ instances.name }}_config.json" mode: "0644" -- name: "Configuration | Importiere Konfuration | {{ instances.name }}" - ansible.builtin.command: - cmd: "php occ config:import /tmp/{{ instances.name }}_config.json --quiet" - chdir: "{{ nextcloud_install_path }}" - become: true - become_user: "{{ instances.user }}" - changed_when: true +# - name: "Configuration | Importiere Konfiguration | {{ instances.name }}" +# ansible.builtin.command: +# cmd: "php occ config:import /tmp/{{ instances.name }}_config.json --quiet" +# chdir: "{{ nextcloud_install_path }}" +# become: true +# become_user: "{{ instances.user }}" +# changed_when: true diff --git a/tasks/hiddenservice.yml b/tasks/hiddenservice.yml index 8315543..08a838c 100644 --- a/tasks/hiddenservice.yml +++ b/tasks/hiddenservice.yml @@ -10,3 +10,12 @@ dest: "/etc/apache2/conf-available/{{ item.name }}.conf" mode: "0644" notify: reload apache + +# Das erste Argument gibt den Platz im Array an, beginnend mit 0. +- name: "Hiddenservice | Richte trusted domains ein | {{ item.name }}" + ansible.builtin.command: + cmd: 'php occ config:system:set trusted_domains {{ item.occ_config.system.trusted_domains | length }} --value "{{ hiddenservice_address.stdout }}" --quiet' + chdir: "{{ nextcloud_install_path }}" + become: true + become_user: "{{ item.user }}" + changed_when: true diff --git a/tasks/main.yml b/tasks/main.yml index 667c92d..77a15ed 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -13,9 +13,11 @@ - name: Setup Gateway ansible.builtin.include_tasks: gateway.yml + tags: always args: apply: delegate_to: "{{ gateway_host }}" + tags: gateway loop: "{{ nextcloud_instances }}" - name: Run database tasks @@ -29,8 +31,11 @@ - name: Run user tasks ansible.builtin.include_tasks: user.yml - tags: user + tags: always loop: "{{ nextcloud_instances }}" + args: + apply: + tags: user - name: Run php tasks ansible.builtin.include_tasks: php.yml @@ -42,12 +47,12 @@ - name: Run Hiddenservice tasks ansible.builtin.include_tasks: hiddenservice.yml - when: item.hiddenservice is defined - loop: "{{ nextcloud_instances }}" tags: always + loop: "{{ nextcloud_instances }}" args: apply: tags: hiddenservice + when: item.hiddenservice is defined - name: Run Webserver tasks ansible.builtin.import_tasks: apache.yml @@ -59,7 +64,6 @@ - name: Configure Nextcloud ansible.builtin.include_tasks: configuration.yml - tags: always args: apply: tags: configuration diff --git a/templates/config.json.j2 b/templates/config.json.j2 index 984f0a1..e5797a9 100644 --- a/templates/config.json.j2 +++ b/templates/config.json.j2 @@ -1 +1 @@ -{{ default_occ_config | ansible.builtin.combine(instances.occ_config, list_merge="appendi_rp", recursive=true) | to_json(indent=4, sort_keys=true) }} +{{ default_occ_config | ansible.builtin.combine(instances.occ_config, list_merge="append_rp", recursive=true) | to_json(indent=4, sort_keys=true) }}