This role creates one or more MySQL databases and users with privileges for them.
Requires the MySQLdb Python package on the remote host.
# vars/main.yml
databases:
testingadb:
name: testdb
user: adm_test
userhost: localhost
password: "{{ db_pass_test }}"
seconddb:
name: seconddb
user: adm_second
userhost: localhost
password: "{{ db_pass_second }}"
# vars/secure.yml
mysql_root_pass: rootpassword
db_pass_test: Mnbvcxz
db_pass_second: Zxcvbnm
You can Vault the secure.yml file.
There are some default variables stored in the defaults/main.yml file - you can change them to the your ones.
# defaults/main.yml
mysql_root: "root"
mysql_port: 3306
- hosts: all
roles:
- mysql-db-user