From: rominique Date: Mon, 15 Apr 2024 00:03:17 +0000 (+0200) Subject: correction backup restore X-Git-Url: https://git.cyclocoop.org/?a=commitdiff_plain;h=0c1a4b36afbe57ab17cb3ec6a0b2605d4e780ca8;p=lhc%2Fansible.git correction backup restore --- diff --git a/tasks/backup_nextcloud.yml b/tasks/backup_nextcloud.yml index f985f82..dd20660 100644 --- a/tasks/backup_nextcloud.yml +++ b/tasks/backup_nextcloud.yml @@ -8,7 +8,7 @@ - name: Create a dump of the postgreSQL database # noqa : command-instead-of-module become: true become_user: "{{ nextcloud_php_user }}" - ansible.builtin.command: "pg_dump -f /tmp/dump.pgc -F c -O -b {{ nextcloud_db_name }}" + ansible.builtin.command: "pg_dump -f /tmp/{{ nextcloud_db_name }}.pgc -F c -O -b {{ nextcloud_db_name }}" args: chdir: "{{ nextcloud_webroot }}" diff --git a/tasks/restore_nextcloud.yml b/tasks/restore_nextcloud.yml index 1fd5315..95e356d 100644 --- a/tasks/restore_nextcloud.yml +++ b/tasks/restore_nextcloud.yml @@ -32,7 +32,7 @@ name: "{{ nextcloud_db_name }}" state: "{{ item }}" owner: "{{ nextcloud_php_user }}" - target: "/tmp/dump.pgc" + target: "/tmp/{{ nextcloud_db_name }}.pgc" target_opts: "-F c" loop: - absent diff --git a/tasks/update_nextcloud.yml b/tasks/update_nextcloud.yml index ad72253..0cc7169 100644 --- a/tasks/update_nextcloud.yml +++ b/tasks/update_nextcloud.yml @@ -69,6 +69,27 @@ ansible.builtin.debug: var: rescue.stdout_lines +- name: Lancement de commande de maintenance # noqa : command-instead-of-module + become_user: "{{ nextcloud_php_user }}" + become: true + ansible.builtin.command: "./console {{ command }}" + args: + chdir: "{{ nextcloud_webroot }}" + loop: + - db:add-missing-columns + - db:add-missing-indices + - db:add-missing-primary-keys + loop_control: + loop_var: command + register: nc_indices_cmd + +- name: Display each occ commands result + ansible.builtin.debug: + msg: "{{ item.stdout_lines }}" + loop: "{{ nc_indices_cmd.results }}" + loop_control: + label: "{{ item.command }}" + - name: Reload php fpm service become: true ansible.builtin.service: diff --git a/update_nuage_instance.yml b/update_nuage_instance.yml index 8760914..3f8fa94 100644 --- a/update_nuage_instance.yml +++ b/update_nuage_instance.yml @@ -94,16 +94,16 @@ always: - - name: Ask if restore is necessary + - name: Demande si besoin de restaurer la version précédente ansible.builtin.pause: prompt: 'Voulez-vous restaurer la version precedente?(oui/non)' echo: true register: restore_promp - - name: Definir config_ss_domain + - name: Definir la variable restore ansible.builtin.set_fact: restore: "{{ restore_promp.user_input | default(non) }}" - - name: Include update tasks + - name: Include restore tasks si restore = oui ansible.builtin.include_tasks: tasks/restore_nextcloud.yml when: restore == 'oui' \ No newline at end of file