No description
  • Python 92.9%
  • Jinja 7.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Adrien Waksberg aef2030cc6
Some checks failed
/ lint (push) Failing after 8s
/ molecule (push) Failing after 2m56s
feat: use mariadb socket for connection
2026-07-23 09:23:38 +02:00
.forgejo/workflows test: add support debian 13 and remove support debian 11 2025-05-25 15:36:48 +02:00
defaults feat: use mariadb socket for connection 2026-07-23 09:23:38 +02:00
handlers chore: add quote for all string in yaml 2025-05-24 21:53:36 +02:00
meta fix: remove all deprecated warnings 2026-07-23 09:23:38 +02:00
molecule test: remove support debian 12 2026-07-23 09:23:38 +02:00
tasks feat: use mariadb socket for connection 2026-07-23 09:23:38 +02:00
templates feat: add support debian 10 and ansible 2.9 2020-02-08 18:07:05 +01:00
.gitignore chore: add quote for all string in yaml 2025-05-24 21:53:36 +02:00
.gitlab-ci.yml test: add support debian 13 and remove support debian 11 2025-05-25 15:36:48 +02:00
.yamllint chore: add quote for all string in yaml 2025-05-24 21:53:36 +02:00
CHANGELOG.md feat: use mariadb socket for connection 2026-07-23 09:23:38 +02:00
LICENSE first version 2019-02-23 18:15:28 +01:00
README.md feat: use mariadb socket for connection 2026-07-23 09:23:38 +02:00

Ansible role: MariaDB

Version License Build

Install and configure MariaDB

Requirements

  • Ansible >= 2.21
  • Debian
    • Trixie

Role variables

Name Type Required Default Comment
mariadb_use_official_repository bool no true use the official repository
mariadb_branch str no 12.3 the branch version to install
mariadb_use_socket bool no true use socket for mariadb connection
mariadb_user str no root login to connect on mariadb
mariadb_password str yes password to connect on mariadb
mariadb_master bool no false the server is master
mariadb_autorestart bool no false restart mariadb when the config change
mariadb_users array no the users to manage
mariadb_databases array no the databases to manage
mariadb_config dict no extra options for configuration

mariadb_users

Name Type Required Default Comment
name str yes the username
host str yes the mysql user host
password str yes the user password
privileges array no the privileges with this form database.*:SELECT,UPDATE)
state str no present if state is absent the user is deleted

Example:

- name: johndoe
  host: "%"
  password: supersecret
  privileges:
    - "database.*:SELECT,UPDATE"
  state: present

mariadb_databases

Name Type Required Default Comment
name str yes the dabase name
state str no present if state is absent the database is deleted

Example:

- name: superprogram
  state: present

mariadb_config

Example:

mysqld:
  server-id: 1
  bind-address: 0.0.0.0

How to use

- hosts: server
  vars:
    mariadb_password: supersecret
    mariadb_users:
      - name: johndoe
        host: "%"
        password: usersecret
        privileges:
          - "myappli.*:ALL"
    mariadb_databases:
      - name: myappli
    mariadb_config:
      server-id: 1
      bind-address: 0.0.0.0
  roles:
    - mariadb

Development

Test with molecule and docker

  • install docker
  • install python3 and python3-pip
  • install molecule and dependencies pip3 install molecule molecule-plugins docker ansible-lint pytest-testinfra yamllint
  • run molecule test

License

Copyright (c) 2019 Adrien Waksberg

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.