ansible-role-mariadb/tasks/munin.yml
2021-01-04 13:33:32 +00:00

41 lines
1.4 KiB
YAML

- name: "Munin: sql-Nutzer anlegen"
mysql_user:
name: "{{ munin_sql_user }}"
password: "{{ munin_sql_password }}"
priv: '*.*:PROCESS,REPLICATION CLIENT'
state: present
login_unix_socket: "{{ mysql_socket }}"
login_user: root
- name: "Munin: Ersetze MariaDB-Zugangsdaten"
template:
src: templates/munin-mariadb.j2
dest: "{{ munin_sql_config_file }}"
notify: restart munin-node
- name: "Munin: Aktiviere mysql-Plugin"
shell: munin-node-configure --shell | grep mysql_ | sh
args:
creates: "{{ munin_sql_config_file }}"
# Ausgabe von fehlerhaften Plugins (exit 1) ignorieren
ignore_errors: yes
notify: restart munin-node
- name: "Munin: Aktiviere slowlog"
lineinfile:
path: "{{ mysql_server_config_file }}"
insertafter: ^# Enable the slow query
line: 'slow_query_log = 1'
notify: restart mysql
- name: "Munin: Konfiguriere slowlog"
lineinfile:
path: "{{ mysql_server_config_file }}"
regexp: "{{ item.regexp }}"
line: "{{ item.line }}"
with_items:
- { regexp: '^#slow_query_log_file', line: 'slow_query_log_file = /var/log/mysql/mariadb-slow.log' }
- { regexp: '^#long_query_time', line: 'long_query_time = 10' }
- { regexp: '^#log_slow_rate_limit', line: 'log_slow_rate_limit = 1000' }
- { regexp: '^#log_slow_verbosity', line: 'log_slow_verbosity = query_plan' }
notify: restart mysql