forked from evolix/ansible-roles
mysql: logdir can be customized
This commit is contained in:
parent
bd1b1a7775
commit
5056f93283
|
@ -20,6 +20,7 @@ The **patch** part changes incrementally at each release.
|
||||||
* postfix: enable SSL/TLS client
|
* postfix: enable SSL/TLS client
|
||||||
* ssl: add an SSL role for certificates deployment
|
* ssl: add an SSL role for certificates deployment
|
||||||
* haproxy: add vars for tls configuration
|
* haproxy: add vars for tls configuration
|
||||||
|
* mysql: logdir can be customized
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
* evocheck: update script from upstream
|
* evocheck: update script from upstream
|
||||||
|
|
|
@ -13,6 +13,7 @@ mysql_replace_root_with_mysqladmin: True
|
||||||
|
|
||||||
mysql_custom_datadir: ''
|
mysql_custom_datadir: ''
|
||||||
mysql_custom_tmpdir: ''
|
mysql_custom_tmpdir: ''
|
||||||
|
mysql_custom_logdir: ''
|
||||||
|
|
||||||
mysql_thread_cache_size: '{{ ansible_processor_cores }}'
|
mysql_thread_cache_size: '{{ ansible_processor_cores }}'
|
||||||
mysql_innodb_buffer_pool_size: '{{ (ansible_memtotal_mb * 0.3) | int }}M'
|
mysql_innodb_buffer_pool_size: '{{ (ansible_memtotal_mb * 0.3) | int }}M'
|
||||||
|
|
45
mysql/tasks/logdir.yml
Normal file
45
mysql/tasks/logdir.yml
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- block:
|
||||||
|
- name: "Is {{ mysql_custom_logdir }} present ?"
|
||||||
|
stat:
|
||||||
|
path: "{{ mysql_custom_logdir }}"
|
||||||
|
check_mode: no
|
||||||
|
register: mysql_custom_logdir_test
|
||||||
|
|
||||||
|
- name: "read the real logdir"
|
||||||
|
command: readlink -f /var/log/mysql
|
||||||
|
changed_when: False
|
||||||
|
check_mode: no
|
||||||
|
register: mysql_current_real_logdir_test
|
||||||
|
tags:
|
||||||
|
- mysql
|
||||||
|
when: mysql_custom_logdir != ''
|
||||||
|
|
||||||
|
- block:
|
||||||
|
- name: MySQL is stopped
|
||||||
|
service:
|
||||||
|
name: mysql
|
||||||
|
state: stopped
|
||||||
|
|
||||||
|
- name: Move MySQL logdir to {{ mysql_custom_logdir }}
|
||||||
|
command: mv {{ mysql_current_real_logdir_test.stdout }} {{ mysql_custom_logdir }}
|
||||||
|
args:
|
||||||
|
creates: "{{ mysql_custom_logdir }}"
|
||||||
|
|
||||||
|
- name: Symlink {{ mysql_custom_logdir }} to /var/log/mysql
|
||||||
|
file:
|
||||||
|
src: "{{ mysql_custom_logdir }}"
|
||||||
|
dest: '/var/log/mysql'
|
||||||
|
state: link
|
||||||
|
|
||||||
|
- name: MySQL is started
|
||||||
|
service:
|
||||||
|
name: mysql
|
||||||
|
state: started
|
||||||
|
tags:
|
||||||
|
- mysql
|
||||||
|
when:
|
||||||
|
- mysql_custom_logdir != ''
|
||||||
|
- mysql_custom_logdir != mysql_current_real_logdir_test.stdout
|
||||||
|
- not mysql_custom_logdir_test.stat.exists
|
|
@ -23,6 +23,8 @@
|
||||||
|
|
||||||
- include: datadir.yml
|
- include: datadir.yml
|
||||||
|
|
||||||
|
- include: logdir.yml
|
||||||
|
|
||||||
- include: tmpdir.yml
|
- include: tmpdir.yml
|
||||||
|
|
||||||
- include: nrpe.yml
|
- include: nrpe.yml
|
||||||
|
|
Loading…
Reference in a new issue