X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=blobdiff_plain;f=tasks%2Fbackup_from_ateliers.yml;h=f47f395daa0227c90d0e2e86c8e1963b32f15747;hb=c99e640f1cb009b1d95475969b0a5f93778be6f9;hp=ea4dcc6f24c8c9838f57f649e4ae35c8965c972a;hpb=925356cb873bdc6560f10a6693da74c8791e97ca;p=lhc%2Fansible.git diff --git a/tasks/backup_from_ateliers.yml b/tasks/backup_from_ateliers.yml index ea4dcc6..f47f395 100644 --- a/tasks/backup_from_ateliers.yml +++ b/tasks/backup_from_ateliers.yml @@ -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 @@ -54,11 +61,11 @@ # become_user: "{{ nextcloud_websrv_user }}" ansible.builtin.fetch: src: "{{ item }}" - dest: "/tmp/nextcloud/{{ domain }}/" + 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 }}"