DCD-686: Initial implementation of DB restore from dump.

This commit is contained in:
Steve Smith
2019-10-08 17:19:44 +11:00
parent 564f06522c
commit c724b0432a

View File

@@ -1,5 +1,7 @@
--- ---
- block:
- name: Create application DB user - name: Create application DB user
postgresql_user: postgresql_user:
login_host: "{{ atl_db_host }}" login_host: "{{ atl_db_host }}"
@@ -9,8 +11,6 @@
name: "{{ atl_jdbc_user }}" name: "{{ atl_jdbc_user }}"
password: "{{ atl_jdbc_password }}" password: "{{ atl_jdbc_password }}"
expires: 'infinity' expires: 'infinity'
tags:
- new_only
- name: Update root privs for new user - name: Update root privs for new user
postgresql_privs: postgresql_privs:
@@ -21,10 +21,8 @@
roles: "{{ atl_db_root_user }}" roles: "{{ atl_db_root_user }}"
objs: "{{ atl_jdbc_user }}" objs: "{{ atl_jdbc_user }}"
type: group type: group
tags:
- new_only
- name: Create application database - name: Create new application database
postgresql_db: postgresql_db:
login_host: "{{ atl_db_host }}" login_host: "{{ atl_db_host }}"
login_user: "{{ atl_db_root_user }}" login_user: "{{ atl_db_root_user }}"
@@ -36,5 +34,24 @@
lc_collate: "{{ atl_jdbc_collation }}" lc_collate: "{{ atl_jdbc_collation }}"
lc_ctype: "{{ atl_jdbc_ctype }}" lc_ctype: "{{ atl_jdbc_ctype }}"
template: "{{ atl_jdbc_template }}" template: "{{ atl_jdbc_template }}"
when: atl_backup_db_dest is not defined
- name: Restore application database
postgresql_db:
login_host: "{{ atl_db_host }}"
login_user: "{{ atl_db_root_user }}"
login_password: "{{ atl_db_root_password }}"
port: "{{ atl_db_port }}"
name: "{{ atl_jdbc_db_name }}"
owner: "{{ atl_jdbc_user }}"
encoding: "{{ atl_jdbc_encoding }}"
lc_collate: "{{ atl_jdbc_collation }}"
lc_ctype: "{{ atl_jdbc_ctype }}"
template: "{{ atl_jdbc_template }}"
# Depends on fetch_backup roles
state: restore
target: "{{ atl_backup_db_dest }}"
when: atl_backup_db_dest is defined
tags: tags:
- new_only - new_only