Add files, handlers, tasks, vars, and meta information.

pull/63/head
Jeff Geerling 10 years ago
parent 032333dbe0
commit 8082fd69b9
  1. 38
      files/my.cnf
  2. 3
      handlers/main.yml
  3. 15
      meta/main.yml
  4. 38
      tasks/main.yml
  5. 3
      templates/my.cnf.j2
  6. 4
      vars/main.yml

@ -0,0 +1,38 @@
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used (fedora >= 15).
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd
user=mysql
# Semisynchronous Replication
# http://dev.mysql.com/doc/refman/5.5/en/replication-semisync.html
# uncomment next line on MASTER
;plugin-load=rpl_semi_sync_master=semisync_master.so
# uncomment next line on SLAVE
;plugin-load=rpl_semi_sync_slave=semisync_slave.so
# Others options for Semisynchronous Replication
;rpl_semi_sync_master_enabled=1
;rpl_semi_sync_master_timeout=10
;rpl_semi_sync_slave_enabled=1
# http://dev.mysql.com/doc/refman/5.5/en/performance-schema.html
;performance_schema
# Customizations for local development.
wait_timeout = 28800
max_allowed_packet = 64M
innodb_file_per_table = 1 # Allows for recovery of disk space when table are removed
innodb_buffer_pool_size = 128M # Up to 80% of available RAM on a dedicated box
innodb_flush_log_at_trx_commit = 2 # 1 for durability, 0 or 2 for performance
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

@ -0,0 +1,3 @@
---
- name: restart mysql
command: service mysqld restart

@ -0,0 +1,15 @@
---
dependencies: []
galaxy_info:
author: geerlingguy
description: MySQL server for RHEL/CentOS 6.x
company: "Midwestern Mac, LLC"
license: "license (BSD, MIT)"
min_ansible_version: 1.4
platforms:
- name: EL
versions:
- 6
categories:
- database

@ -0,0 +1,38 @@
---
# If this is not done for the version of MySQL in certain extra repositories,
# MySQL installation fails with an error the first time.
- name: Update postfix to the latest version.
yum: name=postfix state=latest enablerepo={{ mysql_enablerepo }}
- name: Ensure MySQL packages are installed.
yum: name={{ item }} state=installed enablerepo={{ mysql_enablerepo }}
with_items:
- mysql
- mysql-server
- MySQL-python
- name: Copy my.cnf global MySQL configuration.
copy: src=my.cnf dest=/etc/my.cnf owner=root group=root mode=0644
# Set MySQL to run at startup.
- name: Ensure MySQL is started.
service: name=mysqld state=started enabled=yes
# 'localhost' needs to be the last item for idempotency, see
# http://ansible.cc/docs/modules.html#mysql-user
- name: update mysql root password for all root accounts
mysql_user: name=root host={{ item }} password={{ mysql_root_password }}
with_items:
- 127.0.0.1
- ::1
- localhost
# Has to be after the root password assignment, for idempotency.
- name: Copy .my.cnf file with root password credentials.
template: src=my.cnf.j2 dest=/root/.my.cnf owner=root group=root mode=0600
- name: Delete anonymous MySQL user for localhost.
mysql_user: name="" state="absent"
- name: Remove the MySQL test database.
mysql_db: name="test" state="absent"

@ -0,0 +1,3 @@
[client]
user=root
password={{ mysql_root_password }}

@ -0,0 +1,4 @@
---
# Pass in a comma-separated list of repos to use (e.g. "remi,epel").
mysql_enablerepo: ""
mysql_root_password: root