first commit

This commit is contained in:
xpk
2019-04-30 17:58:27 +08:00
commit f5cbd02646
2 changed files with 51 additions and 0 deletions
+46
View File
@@ -0,0 +1,46 @@
- name: Install mysql community repo
yum:
name: https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
state: installed
- name: Install mysql server, default 8.0
yum:
name:
- mysql-community-server
- mysql-community-libs-compat
state: present
- name: Tune mysql with baseline
blockinfile:
path: /etc/my.cnf
backup: yes
insertafter: '\[mysqld\]'
block: |
open_files_limit=8192
max_connections = 200
wait_timeout=180
innodb_file_per_table
innodb_log_file_size=64M
innodb_log_files_in_group=3
innodb_log_buffer_size=8M
default_storage_engine = innodb
- name: Start up mysql
service:
name: mysqld
state: started
enabled: yes
- name: Grep mysql cred
shell: awk '/temporary password is generated/ {print $NF}' /var/log/mysqld.log
register: mysqlRoot
- name: Set mysql cred in /root/my.cnf
blockinfile:
path: /root/.my.cnf
mode: 0600
block: |
[client]
password = {{ mysqlRoot.stdout }}