/mysql-db-user

Ansible role which creates a new MySQL databases and users

MIT LicenseMIT

Ansible MySQL database and users Build Status

This role creates one or more MySQL databases and users with privileges for them.

Requirements

Requires the MySQLdb Python package on the remote host.

Role Variables

# 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

Example Playbook

    - hosts: all
      roles:
         - mysql-db-user

License

MIT

Author Information

Emil Wypych @gmail