mysql: add a variable to prevent mysql from restarting

This commit is contained in:
Jérémy Lecour 2018-09-13 18:32:19 +02:00 committed by Jérémy Lecour
parent 8ec4ac02b3
commit b2596aad2a
10 changed files with 24 additions and 2 deletions

View File

@ -14,6 +14,7 @@ The **patch** part changes incrementally at each release.
* etc-git: manage a cron job to monitor uncommited changes in /etc/.git (default: `True`) * etc-git: manage a cron job to monitor uncommited changes in /etc/.git (default: `True`)
* evolinux-base: better shell history * evolinux-base: better shell history
* evolinux-users: add user to /etc/aliases * evolinux-users: add user to /etc/aliases
* mysql: add a variable to prevent mysql from restarting
* webapps/evoadmin-web: add users to /etc/aliases * webapps/evoadmin-web: add users to /etc/aliases
### Changed ### Changed

View File

@ -28,6 +28,7 @@ Tasks are extracted in several files, included in `tasks/main.yml` :
* `general_scripts_dir`: general directory for scripts installation (default: `/usr/local/bin`). * `general_scripts_dir`: general directory for scripts installation (default: `/usr/local/bin`).
* `mysql_scripts_dir`: email address to send Log2mail messages to (default: `general_scripts_dir`). * `mysql_scripts_dir`: email address to send Log2mail messages to (default: `general_scripts_dir`).
* `mysql_force_new_nrpe_password` : change the password for NRPE even if it exists already (default: `False`). * `mysql_force_new_nrpe_password` : change the password for NRPE even if it exists already (default: `False`).
* `mysql_restart_if_needed` : should the restart handler be executed (default: `True`)
NB : changing the _datadir_ location can be done multiple times, as long as it is not restored to the default initial location, (because a symlink is created and can't be switched back, yet). NB : changing the _datadir_ location can be done multiple times, as long as it is not restored to the default initial location, (because a symlink is created and can't be switched back, yet).

View File

@ -22,3 +22,5 @@ mysql_cron_mysqltuner: True
mysql_cron_mysqltuner_frequency: monthly mysql_cron_mysqltuner_frequency: monthly
mysql_force_new_nrpe_password: False mysql_force_new_nrpe_password: False
mysql_restart_if_needed: True

View File

@ -14,6 +14,11 @@
name: mysql name: mysql
state: restarted state: restarted
- name: restart mysql (noop)
meta: noop
failed_when: False
changed_when: False
- name: reload systemd - name: reload systemd
systemd: systemd:
name: mysql name: mysql

View File

@ -1,5 +1,8 @@
--- ---
- set_fact:
mysql_restart_handler_name: "{{ mysql_restart_if_needed | bool | ternary('restart mysql', 'restart mysql (noop)') }}"
- include: packages.yml - include: packages.yml
- include: users.yml - include: users.yml

View File

@ -17,7 +17,7 @@
section: mysqld section: mysqld
option: tmpdir option: tmpdir
value: "{{ mysql_custom_tmpdir }}" value: "{{ mysql_custom_tmpdir }}"
notify: restart mysql notify: "{{ mysql_restart_handler_name }}"
tags: tags:
- mysql - mysql
when: mysql_custom_tmpdir != '' when: mysql_custom_tmpdir != ''

View File

@ -40,3 +40,5 @@ mysql_force_new_nrpe_password: False
mysql_evolinux_defaults_file: z-evolinux-defaults.cnf mysql_evolinux_defaults_file: z-evolinux-defaults.cnf
mysql_evolinux_custom_file: zzz-evolinux-custom.cnf mysql_evolinux_custom_file: zzz-evolinux-custom.cnf
mysql_restart_if_needed: True

View File

@ -14,6 +14,11 @@
name: mysql name: mysql
state: restarted state: restarted
- name: restart mysql (noop)
meta: noop
failed_when: False
changed_when: False
- name: reload systemd - name: reload systemd
systemd: systemd:
name: mysql name: mysql

View File

@ -1,5 +1,8 @@
--- ---
- set_fact:
mysql_restart_handler_name: "{{ mysql_restart_if_needed | bool | ternary('restart mysql', 'restart mysql (noop)') }}"
- include: packages_stretch.yml - include: packages_stretch.yml
when: ansible_distribution_major_version | version_compare('9', '>=') when: ansible_distribution_major_version | version_compare('9', '>=')

View File

@ -17,7 +17,7 @@
section: mysqld section: mysqld
option: tmpdir option: tmpdir
value: "{{ mysql_custom_tmpdir }}" value: "{{ mysql_custom_tmpdir }}"
notify: restart mysql notify: "{{ mysql_restart_handler_name }}"
tags: tags:
- mysql - mysql
when: mysql_custom_tmpdir != '' when: mysql_custom_tmpdir != ''