mirror of
https://github.com/aljazceru/ansible-role-mysql.git
synced 2025-12-21 10:54:21 +01:00
Merge branch 'master' of github.com:geerlingguy/ansible-role-mysql
This commit is contained in:
@@ -9,7 +9,7 @@ before_install:
|
|||||||
- sudo apt-get update -qq
|
- sudo apt-get update -qq
|
||||||
|
|
||||||
# Remove MySQL. Completely and totally.
|
# Remove MySQL. Completely and totally.
|
||||||
- sudo apt-get remove --purge -s 'mysql*'
|
- sudo apt-get remove --purge 'mysql*'
|
||||||
- sudo apt-get autoremove
|
- sudo apt-get autoremove
|
||||||
- sudo apt-get autoclean
|
- sudo apt-get autoclean
|
||||||
- sudo rm -rf /var/lib/mysql
|
- sudo rm -rf /var/lib/mysql
|
||||||
|
|||||||
22
README.md
22
README.md
@@ -20,6 +20,14 @@ The home directory inside which Python MySQL settings will be stored, which Ansi
|
|||||||
|
|
||||||
The MySQL root user account password.
|
The MySQL root user account password.
|
||||||
|
|
||||||
|
mysql_databases: []
|
||||||
|
|
||||||
|
The MySQL databases to create. A database has the values `name`, `encoding` (defaults to `utf8`) and `collation` (defaults to `utf8_general_ci`). The formats of these are the same as in the `mysql_db` module.
|
||||||
|
|
||||||
|
mysql_users: []
|
||||||
|
|
||||||
|
The MySQL users and their privileges. A user has the values `name`, `host` (defaults to `localhost`), `password` and `priv` (defaults to `*.*:USAGE`). The formats of these are the same as in the `mysql_user` module.
|
||||||
|
|
||||||
mysql_packages:
|
mysql_packages:
|
||||||
- mysql
|
- mysql
|
||||||
- mysql-server
|
- mysql-server
|
||||||
@@ -37,6 +45,11 @@ The MySQL root user account password.
|
|||||||
|
|
||||||
Default MySQL connection configuration.
|
Default MySQL connection configuration.
|
||||||
|
|
||||||
|
mysql_log_error: /var/log/mysqld.log
|
||||||
|
mysql_syslog_tag: mysqld
|
||||||
|
|
||||||
|
MySQL logging configuration. Setting `mysql_log_error` to `syslog` will make MySQL log to syslog using the `mysql_syslog_tag`.
|
||||||
|
|
||||||
mysql_key_buffer_size: "256M"
|
mysql_key_buffer_size: "256M"
|
||||||
mysql_max_allowed_packet: "1M"
|
mysql_max_allowed_packet: "1M"
|
||||||
mysql_table_open_cache: "256"
|
mysql_table_open_cache: "256"
|
||||||
@@ -59,6 +72,15 @@ None.
|
|||||||
*Inside `vars/main.yml`*:
|
*Inside `vars/main.yml`*:
|
||||||
|
|
||||||
mysql_root_password: super-secure-password
|
mysql_root_password: super-secure-password
|
||||||
|
mysql_databases:
|
||||||
|
- name: example_db
|
||||||
|
encoding: latin1
|
||||||
|
collation: latin1_general_ci
|
||||||
|
mysql_users:
|
||||||
|
- name: example_user
|
||||||
|
host: "%"
|
||||||
|
password: similarly-secure-password
|
||||||
|
priv: "example_db.*:ALL"
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
mysql_user_home: /root
|
mysql_user_home: /root
|
||||||
|
mysql_root_username: root
|
||||||
mysql_root_password: root
|
mysql_root_password: root
|
||||||
|
|
||||||
# Pass in a comma-separated list of repos to use (e.g. "remi,epel"). Used only
|
# Pass in a comma-separated list of repos to use (e.g. "remi,epel"). Used only
|
||||||
@@ -42,3 +43,11 @@ mysql_innodb_lock_wait_timeout: 50
|
|||||||
|
|
||||||
# mysqldump settings
|
# mysqldump settings
|
||||||
mysql_mysqldump_max_allowed_packet: "64M"
|
mysql_mysqldump_max_allowed_packet: "64M"
|
||||||
|
|
||||||
|
# mysqld_safe setting
|
||||||
|
mysql_log_error: /var/log/mysqld.log
|
||||||
|
mysql_syslog_tag: mysqld
|
||||||
|
|
||||||
|
# databases and users settings
|
||||||
|
mysql_databases: []
|
||||||
|
mysql_users: []
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ dependencies: []
|
|||||||
|
|
||||||
galaxy_info:
|
galaxy_info:
|
||||||
author: geerlingguy
|
author: geerlingguy
|
||||||
description: MySQL server for RHEL/CentOS 6.x
|
description: MySQL server for RHEL/CentOS 6.x and Debian/Ubuntu
|
||||||
company: "Midwestern Mac, LLC"
|
company: "Midwestern Mac, LLC"
|
||||||
license: "license (BSD, MIT)"
|
license: "license (BSD, MIT)"
|
||||||
min_ansible_version: 1.4
|
min_ansible_version: 1.4
|
||||||
|
|||||||
@@ -70,3 +70,20 @@
|
|||||||
mysql_db: >
|
mysql_db: >
|
||||||
name="test"
|
name="test"
|
||||||
state=absent
|
state=absent
|
||||||
|
|
||||||
|
- name: Ensure MySQL databases are present.
|
||||||
|
mysql_db: >
|
||||||
|
name="{{ item.name }}"
|
||||||
|
collation="{{ item.collation | default('utf8_general_ci') }}"
|
||||||
|
encoding="{{ item.encoding | default('utf8') }}"
|
||||||
|
state=present
|
||||||
|
with_items: mysql_databases
|
||||||
|
|
||||||
|
- name: Ensure MySQL users are present.
|
||||||
|
mysql_user: >
|
||||||
|
name="{{ item.name }}"
|
||||||
|
host="{{ item.host | default('localhost') }}"
|
||||||
|
password="{{ item.password }}"
|
||||||
|
priv="{{ item.priv | default('*.*:USAGE') }}"
|
||||||
|
state=present
|
||||||
|
with_items: mysql_users
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
[client]
|
[client]
|
||||||
#password = your_password
|
#password = your_password
|
||||||
port = 3306
|
port = {{ mysql_port }}
|
||||||
socket = /var/lib/mysql/mysql.sock
|
socket = {{ mysql_socket }}
|
||||||
|
|
||||||
[mysqld]
|
[mysqld]
|
||||||
port = {{ mysql_port }}
|
port = {{ mysql_port }}
|
||||||
@@ -52,5 +52,11 @@ quick
|
|||||||
max_allowed_packet = {{ mysql_mysqldump_max_allowed_packet }}
|
max_allowed_packet = {{ mysql_mysqldump_max_allowed_packet }}
|
||||||
|
|
||||||
[mysqld_safe]
|
[mysqld_safe]
|
||||||
log-error = /var/log/mysqld.log
|
{% if mysql_log_error == 'syslog' %}
|
||||||
|
syslog
|
||||||
|
syslog-tag = {{ mysql_syslog_tag }}
|
||||||
|
{% else %}
|
||||||
|
skip-syslog
|
||||||
|
log-error = {{ mysql_log_error }}
|
||||||
|
{% endif %}
|
||||||
pid-file = /var/run/mysqld/mysqld.pid
|
pid-file = /var/run/mysqld/mysqld.pid
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
[client]
|
[client]
|
||||||
user=root
|
user={{ mysql_root_username }}
|
||||||
password={{ mysql_root_password }}
|
password={{ mysql_root_password }}
|
||||||
|
|||||||
Reference in New Issue
Block a user