Skip to content

Ansible role which creates a new MySQL databases and users

License

Notifications You must be signed in to change notification settings

ewypych/mysql-db-user

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Releases

No releases published

Packages

No packages published