Ensure database server is running via systemd

This commit is contained in:
phil 2023-11-04 11:01:07 +01:00
parent dd9b42a8b8
commit 66b59e15f6
5 changed files with 16 additions and 24 deletions

View file

@ -0,0 +1,4 @@
# Ansible manages
[Service]
Restart=always

View file

@ -9,7 +9,6 @@
name: mariadb name: mariadb
state: restarted state: restarted
- name: reload monit - name: Reload systemd
service: ansible.builtin.systemd:
name: monit daemon_reload: true
state: reloaded

View file

@ -5,3 +5,12 @@
dest: "/etc/mysql/mariadb.conf.d/90-{{ ansible_hostname }}.cnf" dest: "/etc/mysql/mariadb.conf.d/90-{{ ansible_hostname }}.cnf"
mode: "0644" mode: "0644"
notify: restart mariadb notify: restart mariadb
- name: "Configuration | Copy systemd override"
ansible.builtin.file:
src: systemd/override.conf
dest: /etc/systemd/systemd/mariadb.service.d/
mode: "0644"
notify:
- Reload systemd
- restart mariadb

View file

@ -16,11 +16,6 @@
ansible.builtin.import_tasks: backup.yml ansible.builtin.import_tasks: backup.yml
tags: backup tags: backup
- name: Monit
ansible.builtin.import_tasks: monit.yml
when: "'monit' in ansible_facts.packages"
tags: monit
- name: Configuration - name: Configuration
ansible.builtin.import_tasks: configuration.yml ansible.builtin.import_tasks: configuration.yml
tags: configuration tags: configuration

View file

@ -1,15 +0,0 @@
---
- name: "Monit | Create sql user"
community.mysql.mysql_user:
name: "{{ monit_sql_user }}"
password: "{{ monit_sql_password }}"
state: present
login_unix_socket: "{{ mysql_socket }}"
login_user: root
- name: "Monit | Copy Monit configuration"
ansible.builtin.template:
src: monit.conf.j2
dest: /etc/monit/conf-enabled/mariadb
mode: "0600"
notify: reload monit