Mysql: cron frequency can be changed

This commit is contained in:
Jérémy Lecour 2017-05-19 23:06:12 +02:00
parent 116f82d580
commit f45d7ded46
2 changed files with 12 additions and 3 deletions

View file

@ -16,5 +16,6 @@ mysql_thread_cache_size: '{{ ansible_processor_cores }}'
mysql_innodb_buffer_pool_size: '{{ (ansible_memtotal_mb * 0.3) | int }}M'
mysql_cron_optimize: True
mysql_cron_optimize_frequency: weekly
mysql_force_new_nrpe_password: False

View file

@ -55,16 +55,24 @@
tags:
- mysql
- name: Enable Weekly cron to optimize MySQL
- name: "Cron dir is present"
file:
path: "/etc/cron.{{ mysql_cron_optimize_frequency | mandatory }}"
state: directory
mode: "0755"
owner: root
group: root
- name: "Enable cron to optimize MySQL"
file:
src: "{{ mysql_scripts_dir or general_scripts_dir | mandatory }}/mysql-optimize.sh"
dest: /etc/cron.weekly/mysql-optimize.sh
dest: /etc/cron.{{ mysql_cron_optimize_frequency | mandatory }}/mysql-optimize.sh
state: link
when: mysql_cron_optimize
tags:
- mysql
- name: Disable Weekly cron to optimize MySQL
- name: "Disable cron to optimize MySQL"
file:
dest: /etc/cron.weekly/mysql-optimize.sh
state: absent