bbatsche.MySQL

Ansible MySQL Role

This role helps you install and set up MySQL, MariaDB, or Percona server, as well as create databases and users for those servers.

Important: You can only install one kind of server at a time. Switching between different server types is not supported.

Role Variables

Here are the key settings you can adjust:

  • db_admin: Admin username to create (default is "vagrant").
  • db_pass: Password for the admin user (default is "vagrant").
  • env_name: Environment type such as "development" or "production" (default is "dev").
  • install_mysql: Set to "yes" to install MySQL (default is "no").
  • install_mariadb: Set to "yes" to install MariaDB (default is "no").
  • install_percona: Set to "yes" to install Percona (default is "no").
  • new_db_name: Name of the new database to create (default is not set).
  • new_db_user: New username for database access (default is not set).
  • new_db_pass: Password for the new user (default is not set).
  • new_db_priv: Privileges for the new user (default is full control).
  • remove_root_user: Set to "yes" to remove the root user during installation (default is "yes").
  • mysql_socket: Path to the MySQL socket (default is "/var/run/mysqld/mysqld.sock").
  • mysql_enable_network: Whether to allow external network connections (default is "no").
  • Additional settings for performance tuning and password validation are provided.

Example Playbook

To install a service (MariaDB):

- hosts: servers
  roles:
     - role: bbatsche.MySQL
       install_mariadb: yes

To create a new user (assuming the service is already set up):

- hosts: servers
  roles:
     - role: bbatsche.MySQL
       new_db_user: my_new_user
       new_db_pass: n0tV3ry$ecuRe

License

This role is licensed under the MIT License.

Testing

This role includes tests for verifying each task. To run these tests, you need Vagrant and VirtualBox installed, as well as Ruby and Bundler.

To run all tests:

$ gem install bundler
$ bundle install
$ rake

The tests are designed for Ubuntu Trusty Tahr (14.04), Xenial Xerus (16.04), and Bionic Beaver (18.04). You can check available tests with:

$ rake -T

These tests are to ensure that tasks are carried out correctly, and do not check for repeated application of the same task.

Informazioni sul progetto

Simple role for installing the default version of MySQL for Ubuntu

Installa
ansible-galaxy install bbatsche.MySQL
Licenza
mit
Download
4.8k
Proprietario