|
1234567891011121314151617181920212223242526 |
- ---
- - name: backup directory
- file:
- path: "{{nextcloud_backup_directory}}/{{_nextcloud_actual_version}}"
- state: directory
-
- - name: backup old nextcloud directory
- command: mv
- "{{nextcloud_directory}}/"
- "{{nextcloud_backup_directory}}/{{_nextcloud_actual_version}}/nextcloud"
-
- - name: dump mysql database
- shell: mysqldump "{{nextcloud_database_name}}"
- -h "{{nextcloud_database_host}}"
- -u "{{nextcloud_database_user}}"
- -p
- > "{{nextcloud_backup_directory}}/{{_nextcloud_actual_version}}/database.mysql"
- args:
- stdin: "{{nextcloud_database_pass}}"
- when: nextcloud_database_type == "mysql"
-
- - name: dump postgresql database
- shell: sudo -u postgres pg_dump -O "{{nextcloud_database_name}}"
- > "{{nextcloud_backup_directory}}/{{_nextcloud_actual_version}}/database.pgsql"
- delegate_to: "{{ (nextcloud_database_host != 'localhost') | ternary(nextcloud_database_host,inventory_hostname) }}"
- when: nextcloud_database_type == "postgresql"
|