Files @ 2c24e973d44a
Branch filter:

Location: majic-ansible-roles/roles/database_server/tasks/main.yml

branko
MAR-192: Added support for Debian 12 Bookworm to backup_server role:

- Use test parametrisation instead of looping over a list when testing
correct key usage.
- Replace deprecated key algorithm (in Debian 12 Bookworm) for test
purposes (it just needs to be one of the RSA variants).
---

- name: Install MariaDB
  apt:
    name:
      - mariadb-client
      - mariadb-server
      - python3-pymysql
    state: present

- name: Enable and start MariaDB
  service:
    name: mysql
    state: started
    enabled: true

- name: Set UTF-8 encoding as default for MariaDB
  copy:
    src: "utf8.cnf"
    dest: "/etc/mysql/mariadb.conf.d/90-utf8.cnf"
    owner: root
    group: root
    mode: 0644
  register: mariadb_utf8_configuration

- name: Restart MariaDB in order to use UTF-8 as default character set  # noqa 503
  # [503] Tasks that run when changed should likely be handlers
  #   UTF-8 configuration must be applied immediatelly in order to ensure that
  #   subsequent tasks that create databases will end-up with correct (UTF-8)
  #   encoding. Otherwise they will be created using default latin1.
  service:
    name: mysql
    state: restarted
  when: mariadb_utf8_configuration.changed

- name: Explicitly run all handlers
  include: ../handlers/main.yml
  when: "run_handlers | default(False) | bool()"
  tags:
    - handlers