ajout playbook creation site
[lhc/ansible.git] / tasks / backup_from_ateliers.yml
index ea4dcc6..d662d64 100644 (file)
@@ -1,41 +1,48 @@
 ---
+# Tâches éxecutées sur le serveur ateliers
+
 - name: Create nextcloud restore dir
+  become: true
+  become_user: root
   ansible.builtin.file:
     path: "{{ nextcloud_tmp_path }}"
     state: directory
     mode: '777'
 
-- name: activate nextcloud maintenance mode
-  become_user: "{{ nextcloud_websrv_user }}"
-  become: true
-  command: './console maintenance:mode --on'
-  args:
-    chdir: "{{ nextcloud_webroot }}"
+# - name: Activate nextcloud maintenance mode # noqa : command-instead-of-module
+  become_user: "{{ nextcloud_websrv_user }}"
+  become: true
+#   ansible.builtin.command: './console maintenance:mode --on'
+  args:
+    chdir: "{{ nextcloud_webroot }}"
 
-- name: "Compress directory {{ nextcloud_data_path }} into {{ nextcloud_tmp_path }}/data.tar.gz"
-  become_user: "{{ nextcloud_websrv_user }}"
-  become: true
-  community.general.archive:
-    path: "{{ nextcloud_data_path }}"
-    dest: "{{ nextcloud_tmp_path }}/data.tar.gz"
-    format: gz
-    force_archive: true
-    mode: '777'
+# replace by rsync -t -P --delay-updates -F --compress --archive --partial ateliers:/home/www/data/org/heureux-cyclage/nuages/instances/clavette-gre/data /opt/nuage/backups/clavette-gre/
+# - name: "Compress directory {{ nextcloud_data_path }} into {{ nextcloud_tmp_path }}/data.tar.gz"
+#   become_user: "{{ nextcloud_websrv_user }}"
+#   become: true
+#   community.general.archive:
+#     path: "{{ nextcloud_data_path }}"
+#     dest: "{{ nextcloud_tmp_path }}/data.tar.gz"
+#     format: gz
+#     force_archive: true
+#     mode: '777'
 
 - name: Create a dump of the postgreSQL database # noqa : command-instead-of-module
   become: true
   become_user: "{{ nextcloud_websrv_user }}"
-  ansible.builtin.command: "pg_dump -f dump.sql -F c -O -b {{ nextcloud_db_name }}"
+  ansible.builtin.command: "pg_dump -f dump.pgc -F c -O -b {{ nextcloud_db_name }}"
   args:
     chdir: "{{ nextcloud_tmp_path }}"
 
-- name: copy nextcloud config file
+# rsync -t -P --delay-updates -F --compress --archive --partial ateliers:/tmp/nextcloud_restore/dump.pgc /opt/nuage/backups/clavette-gre/
+
+- name: Copy nextcloud config file
   become_user: "{{ nextcloud_websrv_user }}"
   become: true
-  ansible.builtin.copy: 
+  ansible.builtin.copy:
     src: "{{ nextcloud_webroot }}/config/config.php"
     dest: "{{ nextcloud_tmp_path }}/config.php"
-    remote_src: yes # because the config file is already in the nextcloud_tmp_path
+    remote_src: true # because the config file is already in the nextcloud_tmp_path
     mode: '755'
 
 - name: Add read permissions to created tmp files
@@ -57,8 +64,8 @@
     dest: "/tmp/nextcloud/{{ domain }}/"
     flat: true
   loop:
-    - "{{ nextcloud_tmp_path }}/dump.sql"
-    - "{{ nextcloud_tmp_path }}/data.tar.gz"
+    - "{{ nextcloud_tmp_path }}/dump.pgc"
+#    - "{{ nextcloud_tmp_path }}/data.tar.gz"
     - "{{ nextcloud_tmp_path }}/config.php"
 
 - name: Supprimer les fichiers temporaires du serveur ateliers
@@ -68,8 +75,8 @@
     path: "{{ item }}"
     state: absent
   loop:
-    - "{{ nextcloud_tmp_path }}/dump.sql"
-    - "{{ nextcloud_tmp_path }}/data.tar.gz"
+    - "{{ nextcloud_tmp_path }}/dump.pgc"
+    - "{{ nextcloud_tmp_path }}/data.tar.gz"
     - "{{ nextcloud_tmp_path }}/config.php"
 
 # - name: deactivate nextcloud maintenance mode
@@ -77,4 +84,4 @@
 #   become: true
 #   command: './console maintenance:mode --off'
 #   args:
-#    chdir: "{{ nextcloud_webroot }}"
\ No newline at end of file
+#    chdir: "{{ nextcloud_webroot }}"