Install mariadb by default.

This commit is contained in:
Andrea Dell'Amico 2025-02-06 14:16:31 +01:00
parent 5a0ae87d7e
commit c88e5ce7be
Signed by: adellam
GPG Key ID: 147ABE6CEB9E20FF
2 changed files with 16 additions and 4 deletions

View File

@ -1,5 +1,6 @@
---
mysql_enabled: True
mysql_enabled: true
mysql_installs_mariadb: true
mysql_pkg_state: present
mysql_conf_dir: /etc/mysql/conf.d
mysql_service_conf_dir: /etc/mysql/mysql.conf.d
@ -21,6 +22,14 @@ mysql_packages_list:
- "{% if ansible_distribution_version is version_compare('20.04', '>=') %}python3-pymysql{% else %}python-pymysql{% endif %}"
- "{% if ansible_distribution_version is version_compare('20.04', '>=') %}python3-mysql.connector{% else %}python-mysql.connector{% endif %}"
mysql_mariadb_pkgs:
- mariadb-server
- mariadb-client
- "{% if ansible_distribution_version is version_compare('24.04', '<') %}mytop{% else %}mycli{% endif %}"
- "{% if ansible_distribution_version is version_compare('20.04', '>=') %}python3-mysqldb{% else %}python-mysqldb{% endif %}"
- "{% if ansible_distribution_version is version_compare('20.04', '>=') %}python3-pymysql{% else %}python-pymysql{% endif %}"
- "{% if ansible_distribution_version is version_compare('20.04', '>=') %}python3-mysql.connector{% else %}python-mysql.connector{% endif %}"
mysql_db_name: db_name
mysql_db_user: db_user
mysql_db_pwd: "We cannot save the password into the repository. Use another variable and change pgpass.j2 accordingly. Encrypt the file that contains the variable with ansible-vault"

View File

@ -1,6 +1,9 @@
---
- name: install the mysql packages
apt: pkg={{ item }} state={{ mysql_pkg_state }}
with_items: '{{ mysql_packages_list }}'
- name: Install the mysql or maridb server packages
ansible.builtin.apt:
pkg: "{{ item }}"
cache_valid_time: 1800
state: present
loop: '{% if mysql_installs_mariadb {{ +mysql_mariadb_pkgs }}{% else %}{{ mysql_packages_list }}{% endif %}'
tags: mysql