mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2025-12-14 00:43:06 -06:00
ITOPSENG-333 prevent db_create if db already exists
This commit is contained in:
@@ -10,6 +10,15 @@
|
||||
password: "{{ atl_jdbc_password }}"
|
||||
expires: 'infinity'
|
||||
|
||||
- name: Collect dbcluster db_names
|
||||
postgresql_query:
|
||||
login_host: "{{ atl_db_host }}"
|
||||
login_user: "{{ atl_db_root_user }}"
|
||||
login_password: "{{ atl_db_root_password }}"
|
||||
db: "{{ atl_db_root_db_name }}"
|
||||
query: "SELECT datname FROM pg_database;"
|
||||
register: dbcluster_db_names
|
||||
|
||||
- block:
|
||||
|
||||
- name: Update root privs for new user
|
||||
@@ -35,6 +44,7 @@
|
||||
lc_ctype: "{{ atl_jdbc_ctype }}"
|
||||
template: "{{ atl_jdbc_template }}"
|
||||
register: db_created
|
||||
when: "atl_jdbc_db_name not in (dbcluster_db_names.query_result | map(attribute='datname') )"
|
||||
|
||||
tags:
|
||||
- new_only
|
||||
@@ -62,4 +72,3 @@
|
||||
login_password: "{{ atl_db_root_password }}"
|
||||
db: "{{ atl_jdbc_db_name }}"
|
||||
query: "GRANT ALL ON SCHEMA public TO {{ atl_jdbc_user }};"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user