plumelo.mysql
MySQL
========
This guide explains how to install and set up MySQL, MariaDB, or Percona server on Ubuntu servers.
Requirements
- You need Ansible version 2.3 or higher.
Installation
To install the role, use this command:
ansible-galaxy install plumelo.mysql
Role Variables
Here are the variables you can use, along with their default values (found in defaults/main.yml
):
# Installation type (set to "configuration_only" if MySQL is already installed
# and you only want to configure it)
mysql_installation_type: ""
# Choose the database package: mysql, mariadb, or percona
mysql_package: mysql
# If using Percona, specify the version you want
percona_version: '5.7'
# Hosts that MySQL will run on
mysql_hosts:
- "{{ ansible_hostname }}"
- localhost
- ...
# MySQL database settings (name and optional path to import)
mysql_databases:
- name: test
path: /your_path_to_db.sql
- name: test
path: /your_path_to_sql.bz2
- name: test
path: /your_path_to_sql.gz
# MySQL user settings (define users with name, password, host, and privileges)
mysql_users:
- name: user
password:
- 12345
privs:
- '*.*:ALL'
hosts:
- localhost
state:
- present
- name: user1
privs:
- user1.*:ALL
hosts:
- 127.0.0.1
# MySQL server configuration settings (add your desired configurations here)
mysql_config:
mysqld:
port: 3306
socket: /var/run/mysqld/mysql.sock
mysql:
no_auto_rehash: ~
max_allowed_packet: 16M
prompt: '\u@\h [\d]> '
default_character_set: utf8
mysqldump:
max_allowed_packet: 16M
mysqld_safe:
open_files_limit: 8192
user: mysql
log-error: <hostname>_error.log
Dependencies
- There are no special requirements.
Example Playbook
Here’s a simple example of how to use this role with variables:
- hosts: all
become: 'yes'
roles:
- role: plumelo.mysql
License
This role is licensed under BSD.
Author Information
- Developed by plumelo.com
Installa
ansible-galaxy install plumelo.mysql
Licenza
gpl-3.0
Download
524
Proprietario