- 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 }}"
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
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:
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