Getting started

Example inventory

To install MariaDB on a host, you need to add it to [debops_service_mariadb_server] Ansible group:


This will install mariadb-server package, configure the server to listen on localhost for new connections, and install automysqlbackup script to automatically create daily, weekly and monthly backups of the database.

Example playbook

Here's an example Ansible playbook that uses the debops.mariadb_server role:


- name: Manage MariaDB database server
  hosts: [ 'debops_service_mariadb_server' ]
  become: True


    - role: debops.ferm
      tags: [ 'role::ferm' ]
        - '{{ mariadb_server__ferm__dependent_rules }}'

    - role: debops.tcpwrappers
      tags: [ 'role::tcpwrappers' ]
        - '{{ mariadb_server__tcpwrappers__dependent_allow }}'

    - role: debops.mariadb_server
      tags: [ 'role::mariadb_server' ]

Remote access to the database

If you want to allow connections from remote hosts to the MariaDB server, you need to change the bind address to listen on all network interfaces, and specify the list of IP addresses or CIDR networks which can connect to the daemon:

mariadb_server__bind_address: '::'
mariadb_server__allow: [ '', '2001:db8:3232::/64' ]

Changing the bind address will require the MariaDB daemon to be restarted, however debops.mariadb_server does not do that automatically to avoid distrupting the normal server operations. To restart the service, you can run this Ansible command:

user@host:~$ ansible database-host -s -m service -a 'name=mysql state=restarted'

Note the mysql service name - MariaDB still uses the old MySQL init files, configuration and data paths to allow easy compatibility with old MySQL installations.

Database and user management

debops.mariadb_server is not meant to be used to manage databases and user accounts. You should use debops.mariadb role instead, which was designed specifically for this purpose.