No Description

Edin Sarajlic 8a877c1641 Add README 3 years ago
tasks 974394c39a Add task for creating user for MySQL database 3 years ago
templates 4db4404cc2 Add task for configuring autologin using my.cnf (setting username/password of user) 3 years ago
README 8a877c1641 Add README 3 years ago


A role for installing and configuring a MySQL (MariaDB) server.

Written for Debian-like systems.

Confirmed to be working on Debian Jessie.

Clone this git repo into your Ansible's role directory, e.g.:

git clone ansible-mysqlserver.git roles/mysqlserver

This role performs the following actions:
- Installs the MySQL server software
- Installs 'automysqlbackup' (default config performs nightly backups of all DBs)
- Installs 'python-mysqldb' (allows Ansible to perform tasks on the MySQL server)

Variables to define:
mysqlserver_root_password - MySQL root user's password

Variables to define for tasks/configure_autologin_mycnf.yml:
mysqlcli_user - The OS-user for which to configure my.cnf
mysqlserver_mycnf_user - The DB-user for auto-login
mysqlserver_mycnf_password - The DB-user's password for auto-login

NOTE: The below task is provided for convenience, use with discretion.

This role provides an optional task (setup_app_db.yml) that can be
used to bootstrap a database, user, and privileges - as required by
*most* types of webapps.

Variables to define:
db_name - The name of the database to create
db_username - The username of the user to create for the above database instance
db_password - The password of the above user

To use the task, create a play for each database/user/privilege combo you require, e.g.:
- name: Database for ExampleCMS for MyWebsite
hosts: mywebsitehost

- mysqlserver

- include: roles/mysqlserver/tasks/setup_app_db.yml

db_name: ecms_mywebsite
db_username: ecms_mywebsite_user
db_password: supersecretpassword