MySQL: enable/disable optimize script in weekly crontab

This commit is contained in:
Jérémy Lecour 2017-01-03 09:39:31 +01:00 committed by Jérémy Lecour
parent 35f423a869
commit 15d1b4d6fe
2 changed files with 25 additions and 4 deletions

View File

@ -14,3 +14,5 @@ mysql_custom_tmpdir: ''
mysql_thread_cache_size: '{{ ansible_processor_cores }}'
mysql_innodb_buffer_pool_size: '{{ (ansible_memtotal_mb * 0.3) | int }}M'
mysql_cron_optimize: True

View File

@ -15,6 +15,8 @@
shell: cat /etc/mysql/debian.cnf | grep -m1 "password = .*" | cut -d" " -f3
register: mysql_debian_password
changed_when: False
tags:
- mysql
- name: Configure mytop
template:
@ -42,15 +44,31 @@
name: aha
tags:
- mysql
- mysqltuner
# automatic optimizations
- name: Weekly cron to optimize MySQL
- name: Optimize script for MySQL
copy:
src: mysql-optimize
src: mysql-optimize.sh
dest: "{{ mysql_scripts_dir or general_scripts_dir | mandatory }}/mysql-optimize.sh"
mode: 0700
tags:
- mysql
- name: Enable Weekly cron to optimize MySQL
file:
src: "{{ mysql_scripts_dir or general_scripts_dir | mandatory }}/mysql-optimize.sh"
dest: /etc/cron.weekly/mysql-optimize.sh
mode: 0755
state: link
when: mysql_cron_optimize
tags:
- mysql
- name: Disable Weekly cron to optimize MySQL
file:
dest: /etc/cron.weekly/mysql-optimize.sh
state: absent
when: not mysql_cron_optimize
tags:
- mysql
@ -61,6 +79,7 @@
name: apg
tags:
- mysql
- packages
- name: Ensure /usr/share/scripts exists
file: