correction backup restore
authorrominique <romain.legoff@heureux-cyclage.org>
Mon, 15 Apr 2024 00:03:17 +0000 (02:03 +0200)
committerrominique <romain.legoff@heureux-cyclage.org>
Mon, 15 Apr 2024 00:03:17 +0000 (02:03 +0200)
tasks/backup_nextcloud.yml
tasks/restore_nextcloud.yml
tasks/update_nextcloud.yml
update_nuage_instance.yml

index f985f82..dd20660 100644 (file)
@@ -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 }}"
 
index 1fd5315..95e356d 100644 (file)
@@ -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
index ad72253..0cc7169 100644 (file)
       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:
index 8760914..3f8fa94 100644 (file)
 
       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