re-rename the files

This commit is contained in:
Adam Brokes
2020-07-15 16:11:17 +10:00
parent 76e739234b
commit 4585aac6d1
2 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
---
- name: Make sure mariadb is present
become: true
yum:
name: mariadb
state: present
- name: Make sure pymysql is present
become: true
pip:
name: pymysql
state: present
- name: Create application DB user
mysql_user:
login_host: "{{ atl_db_host }}"
login_user: "{{ atl_db_root_user }}"
login_password: "{{ atl_db_root_password }}"
login_port: "{{ atl_db_port }}"
name: "{{ atl_jdbc_user }}"
password: "{{ atl_jdbc_password }}"
- block:
# RDS does not allow changing the collation on an existing DB, it only allows collation change on creation of db. If the db already exists, we need the “create new application database” task to be skipped, idempotence can not be relied upon as we cant be certain the collation of the existing db
- name: Create new application database
mysql_db:
login_host: "{{ atl_db_host }}"
login_user: "{{ atl_db_root_user }}"
login_password: "{{ atl_db_root_password }}"
login_port: "{{ atl_db_port }}"
name: "{{ atl_jdbc_db_name }}"
encoding: "utf8" # TODO "{{ atl_jdbc_encoding }}"
collation: "utf8_bin" # TODO "{{ atl_jdbc_collation }}"
register: db_created
tags:
- new_only
- name: Assert ownership of public schema
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="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;"
# - name: Grant privs to root user on public schema
# postgresql_query:
# login_host: "{{ atl_db_host }}"
# login_user: "{{ atl_db_root_user }}"
# login_password: "{{ atl_db_root_password }}"
# db: "{{ atl_jdbc_db_name }}"
# query: "GRANT ALL ON SCHEMA public TO {{ atl_db_root_user }};"
# - name: Grant privs to application user on public schema
# postgresql_query:
# login_host: "{{ atl_db_host }}"
# login_user: "{{ atl_db_root_user }}"
# login_password: "{{ atl_db_root_password }}"
# db: "{{ atl_jdbc_db_name }}"
# query: "GRANT ALL ON SCHEMA public TO {{ atl_jdbc_user }};"