Initial Commit
This commit is contained in:
21
copy_all_users.yml
Normal file
21
copy_all_users.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
- name: Copy user database from a one nextcloud to another
|
||||
hosts: all
|
||||
vars:
|
||||
container_name: "db"
|
||||
tasks:
|
||||
- debug: msg="{{ nextcloud_admin_passwd }}"
|
||||
- name: Backup Postgres necessary table on src
|
||||
block:
|
||||
- shell: "docker exec -u postgres {{ container_name }} pg_dump --clean -t public.oc_accounts -t public.oc_users -t public.oc_groups -t public.oc_group_admin -t public.oc_group_user nextcloud > /tmp/nextcloud_backup.sql"
|
||||
- name: Fetch the SQL dump from src
|
||||
run_once: yes
|
||||
fetch: src=/tmp/nextcloud_backup.sql dest=/tmp/ flat=yes
|
||||
when: inventory_hostname == "nextcloud-src"
|
||||
- name: Restore Postgres necessary table on dst
|
||||
block:
|
||||
- name: Copy the SQL dump to dst
|
||||
copy: src=/tmp/nextcloud_backup.sql dest=//tmp/
|
||||
become: yes
|
||||
- shell: "docker exec -i -u postgres {{ container_name }} psql nextcloud < /tmp/nextcloud_backup.sql"
|
||||
when: inventory_hostname == "nextcloud-dst"
|
||||
Reference in New Issue
Block a user