add mysql permissions

This commit is contained in:
Adam Brokes
2020-07-14 17:33:53 +10:00
parent 598ef33ef6
commit 0e5da47ef0
3 changed files with 31 additions and 10 deletions

View File

@@ -110,6 +110,7 @@ atl_jdbc_ctype: "{{ lookup('env', 'ATL_JDBC_CTYPE') or 'en_US.UTF-8' }}"
atl_jdbc_template: "{{ lookup('env', 'ATL_JDBC_TEMPLATE') or 'template1' }}" atl_jdbc_template: "{{ lookup('env', 'ATL_JDBC_TEMPLATE') or 'template1' }}"
atl_jdbc_query_params_for_engine: atl_jdbc_query_params_for_engine:
aurora_postgres: "?targetServerType=master" aurora_postgres: "?targetServerType=master"
rds_mysql: "?useUnicode=true&characterEncoding=UTF8&sessionVariables=default_storage_engine=InnoDB"
atl_jdbc_engine_map: atl_jdbc_engine_map:
aurora_postgres: "postgres" aurora_postgres: "postgres"
rds_postgres: "postgres" rds_postgres: "postgres"

View File

@@ -31,20 +31,18 @@
login_password: "{{ atl_db_root_password }}" login_password: "{{ atl_db_root_password }}"
login_port: "{{ atl_db_port }}" login_port: "{{ atl_db_port }}"
name: "{{ atl_jdbc_db_name }}" name: "{{ atl_jdbc_db_name }}"
encoding: "{{ atl_jdbc_encoding }}" encoding: "utf8" # TODO "{{ atl_jdbc_encoding }}"
collation: "{{ atl_jdbc_collation }}" collation: "utf8_bin" # TODO "{{ atl_jdbc_collation }}"
register: db_created register: db_created
tags: tags:
- new_only - new_only
# - name: Assert ownership of public schema - name: Assert ownership of public schema
# postgresql_query: command: >
# login_host: "{{ atl_db_host }}" mysql --user={{ atl_jdbc_user }} --password={{ atl_jdbc_password }} {{ atl_jdbc_db_name }}
# login_user: "{{ atl_db_root_user }}" --host={{ atl_db_host }} --port={{ atl_db_port }} --batch --skip-column-names
# login_password: "{{ atl_db_root_password }}" --execute="GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER,INDEX on {{ atl_jdbc_db_name }}.* TO '{{ atl_jdbc_user }}'@'{{ atl_db_host }}' IDENTIFIED BY '{{ atl_jdbc_password }}'; flush privileges;"
# db: "{{ atl_jdbc_db_name }}"
# query: "ALTER SCHEMA public OWNER to {{ atl_db_root_user }};"
# - name: Grant privs to root user on public schema # - name: Grant privs to root user on public schema
# postgresql_query: # postgresql_query:

View File

@@ -100,11 +100,16 @@
- "{{ atl_product_installation_versioned }}/work" - "{{ atl_product_installation_versioned }}/work"
changed_when: false # For Molecule idempotence check changed_when: false # For Molecule idempotence check
- name: Assert baseurl to same as atl_proxy_name - name: Do something with stuff
debug: "{{ item }}"
with_items: stuff.stdout_lines
- name: Assert baseurl to same as atl_proxy_name (PostgreSQL)
postgresql_query: postgresql_query:
login_host: "{{ atl_db_host }}" login_host: "{{ atl_db_host }}"
login_user: "{{ atl_jdbc_user }}" login_user: "{{ atl_jdbc_user }}"
login_password: "{{ atl_jdbc_password }}" login_password: "{{ atl_jdbc_password }}"
port: "{{ atl_db_port }}"
db: "{{ atl_jdbc_db_name }}" db: "{{ atl_jdbc_db_name }}"
query: > query: >
update propertystring set propertyvalue=%s update propertystring set propertyvalue=%s
@@ -115,6 +120,23 @@
- atl_proxy_name is defined - atl_proxy_name is defined
- atl_tomcat_scheme is defined - atl_tomcat_scheme is defined
- db_created is undefined or not db_created.changed - db_created is undefined or not db_created.changed
- atl_jdbc_engine_map[atl_db_engine] = 'postgres'
tags:
- skip_on_stack_update
ignore_errors: yes # For Molecule as it has no db test framework included
- name: Assert baseurl to same as atl_proxy_name (MySQL)
command: >
mysql --user={{ atl_jdbc_user }} --password={{ atl_jdbc_password }} {{ atl_jdbc_db_name }}
--host={{ atl_db_host }} --port={{ atl_db_port }} --batch --skip-column-names
--execute="update propertystring set propertyvalue="{{ atl_tomcat_scheme }}://{{ atl_proxy_name }}{{ atl_tomcat_contextpath }}"
where id=(select id from propertyentry where property_key = 'jira.baseurl')"
when:
- atl_proxy_name is defined
- atl_tomcat_scheme is defined
- db_created is undefined or not db_created.changed
- atl_jdbc_engine_map[atl_db_engine] = 'mysql'
tags: tags:
- skip_on_stack_update - skip_on_stack_update
ignore_errors: yes # For Molecule as it has no db test framework included ignore_errors: yes # For Molecule as it has no db test framework included