change atl_db_password to use the aws_secrets_manager lookups

This commit is contained in:
Andy Rajagopalan
2020-07-29 11:54:27 -07:00
parent 18ede3f854
commit 83ab6009c8

View File

@@ -1,13 +1,14 @@
--- ---
- name: debug message #- name: debug message
debug: msg="{{ lookup('aws_secret','atl_db_root_password_secret', region='atl_aws_region') }}" # debug: msg="{{ (lookup('aws_secret', atl_db_root_password_secret, region=atl_aws_region) | from_json.get('password')) }}"
- name: Create application DB user - name: Create application DB user
postgresql_user: postgresql_user:
login_host: "{{ atl_db_host }}" login_host: "{{ atl_db_host }}"
login_user: "{{ atl_db_root_user }}" login_user: "{{ atl_db_root_user }}"
login_password: "{{ atl_db_root_password }}" #login_password: "{{ atl_db_root_password }}"
login_password: "{{ (lookup('aws_secret',atl_db_root_password_secret, region=atl_aws_region) | from_json | json_query('password')) }}"
port: "{{ atl_db_port }}" port: "{{ atl_db_port }}"
name: "{{ atl_jdbc_user }}" name: "{{ atl_jdbc_user }}"
password: "{{ atl_jdbc_password }}" password: "{{ atl_jdbc_password }}"
@@ -17,7 +18,8 @@
postgresql_query: postgresql_query:
login_host: "{{ atl_db_host }}" login_host: "{{ atl_db_host }}"
login_user: "{{ atl_db_root_user }}" login_user: "{{ atl_db_root_user }}"
login_password: "{{ atl_db_root_password }}" #login_password: "{{ atl_db_root_password }}"
login_password: "{{ (lookup('aws_secret',atl_db_root_password_secret, region=atl_aws_region) | from_json | json_query('password')) }}"
db: "{{ atl_db_root_db_name }}" db: "{{ atl_db_root_db_name }}"
query: "SELECT datname FROM pg_database;" query: "SELECT datname FROM pg_database;"
register: dbcluster_db_names register: dbcluster_db_names
@@ -28,7 +30,8 @@
postgresql_privs: postgresql_privs:
login_host: "{{ atl_db_host }}" login_host: "{{ atl_db_host }}"
login_user: "{{ atl_db_root_user }}" login_user: "{{ atl_db_root_user }}"
login_password: "{{ atl_db_root_password }}" #login_password: "{{ atl_db_root_password }}"
login_password: "{{ (lookup('aws_secret',atl_db_root_password_secret, region=atl_aws_region) | from_json | json_query('password')) }}"
database: postgres database: postgres
roles: "{{ atl_db_root_user }}" roles: "{{ atl_db_root_user }}"
objs: "{{ atl_jdbc_user }}" objs: "{{ atl_jdbc_user }}"
@@ -39,7 +42,8 @@
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 }}"
login_password: "{{ atl_db_root_password }}" #login_password: "{{ atl_db_root_password }}"
login_password: "{{ (lookup('aws_secret',atl_db_root_password_secret, region=atl_aws_region) | from_json | json_query('password')) }}"
port: "{{ atl_db_port }}" port: "{{ atl_db_port }}"
name: "{{ atl_jdbc_db_name }}" name: "{{ atl_jdbc_db_name }}"
owner: "{{ atl_jdbc_user }}" owner: "{{ atl_jdbc_user }}"
@@ -57,7 +61,8 @@
postgresql_query: postgresql_query:
login_host: "{{ atl_db_host }}" login_host: "{{ atl_db_host }}"
login_user: "{{ atl_db_root_user }}" login_user: "{{ atl_db_root_user }}"
login_password: "{{ atl_db_root_password }}" #login_password: "{{ atl_db_root_password }}"
login_password: "{{ (lookup('aws_secret',atl_db_root_password_secret, region=atl_aws_region) | from_json | json_query('password')) }}"
db: "{{ atl_jdbc_db_name }}" db: "{{ atl_jdbc_db_name }}"
query: "ALTER SCHEMA public OWNER to {{ atl_db_root_user }};" query: "ALTER SCHEMA public OWNER to {{ atl_db_root_user }};"
@@ -65,7 +70,8 @@
postgresql_query: postgresql_query:
login_host: "{{ atl_db_host }}" login_host: "{{ atl_db_host }}"
login_user: "{{ atl_db_root_user }}" login_user: "{{ atl_db_root_user }}"
login_password: "{{ atl_db_root_password }}" #login_password: "{{ atl_db_root_password }}"
login_password: "{{ (lookup('aws_secret',atl_db_root_password_secret, region=atl_aws_region) | from_json | json_query('password')) }}"
db: "{{ atl_jdbc_db_name }}" db: "{{ atl_jdbc_db_name }}"
query: "GRANT ALL ON SCHEMA public TO {{ atl_db_root_user }};" query: "GRANT ALL ON SCHEMA public TO {{ atl_db_root_user }};"
@@ -73,6 +79,7 @@
postgresql_query: postgresql_query:
login_host: "{{ atl_db_host }}" login_host: "{{ atl_db_host }}"
login_user: "{{ atl_db_root_user }}" login_user: "{{ atl_db_root_user }}"
login_password: "{{ atl_db_root_password }}" #login_password: "{{ atl_db_root_password }}"
login_password: "{{ (lookup('aws_secret',atl_db_root_password_secret, region=atl_aws_region) | from_json | json_query('password')) }}"
db: "{{ atl_jdbc_db_name }}" db: "{{ atl_jdbc_db_name }}"
query: "GRANT ALL ON SCHEMA public TO {{ atl_jdbc_user }};" query: "GRANT ALL ON SCHEMA public TO {{ atl_jdbc_user }};"