Raw refactoring of roles

This commit is contained in:
2025-05-09 17:47:33 +02:00
parent 82f442f40e
commit 5b47333955
177 changed files with 1483 additions and 1041 deletions

View File

@@ -2,5 +2,5 @@
## Execute SQL commands
```bash
docker exec -it central-mariadb mariadb -u root -p
docker exec -it {{capplications.mariadb.hostname }} mariadb -u root -p
```

View File

@@ -0,0 +1,26 @@
---
galaxy_info:
author: "Kevin Veen-Birkenbach"
description: >-
The Docker MariaDB Role offers an easy and efficient way to deploy a MariaDB server inside a Docker container.
Manage your data securely and effectively, making it ideal for production or local development.
license: "CyMaIS NonCommercial License (CNCL)"
license_url: "https://s.veen.world/cncl"
company: |
Kevin Veen-Birkenbach
Consulting & Coaching Solutions
https://www.veen.world
min_ansible_version: "2.9"
platforms:
- name: Docker
versions:
- "latest"
galaxy_tags:
- mariadb
- docker
- database
- administration
- central-database
repository: "https://s.veen.world/cymais"
issue_tracker_url: "https://s.veen.world/cymaisissues"
documentation: "https://s.veen.world/cymais"

View File

@@ -0,0 +1,5 @@
credentials:
root_password:
description: "Password for the MariaDB root user"
algorithm: "bcrypt"
validation: "^\\$2[aby]\\$.{56}$"

View File

@@ -8,11 +8,11 @@
- name: install MariaDB
docker_container:
name: central-mariadb
name: "{{capplications.mariadb.hostname }}"
image: "mariadb:{{applications.mariadb.version}}" #could lead to problems with nextcloud
detach: yes
env:
MARIADB_ROOT_PASSWORD: "{{central_mariadb_root_password}}"
MARIADB_ROOT_PASSWORD: "{{applications.mariadb.credentials.root_password}}"
MARIADB_AUTO_UPGRADE: "1"
networks:
- name: central_mariadb
@@ -23,7 +23,7 @@
command: "--transaction-isolation=READ-COMMITTED --binlog-format=ROW" #for nextcloud
restart_policy: "{{docker_restart_policy}}"
healthcheck:
test: "/usr/bin/mariadb --user=root --password={{central_mariadb_root_password}} --execute \"SHOW DATABASES;\""
test: "/usr/bin/mariadb --user=root --password={{applications.mariadb.credentials.root_password}} --execute \"SHOW DATABASES;\""
interval: 3s
timeout: 1s
retries: 5
@@ -38,7 +38,7 @@
- name: Wait until the MariaDB container is healthy
community.docker.docker_container_info:
name: central-mariadb
name: "{{capplications.mariadb.hostname }}"
register: db_info
until: db_info.containers[0].State.Health.Status == "healthy"
retries: 30
@@ -53,7 +53,7 @@
name: "{{ database_name }}"
state: present
login_user: root
login_password: "{{ central_mariadb_root_password }}"
login_password: "{{ applications.mariadb.credentials.root_password }}"
login_host: 127.0.0.1
login_port: "{{database_port}}"
@@ -65,13 +65,13 @@
priv: '{{database_name}}.*:ALL'
state: present
login_user: root
login_password: "{{central_mariadb_root_password}}"
login_password: "{{applications.mariadb.credentials.root_password}}"
login_host: 127.0.0.1
login_port: "{{database_port}}"
- name: Grant database privileges
ansible.builtin.shell:
cmd: "docker exec central-mariadb mariadb -u root -p{{ central_mariadb_root_password }} -e \"GRANT ALL PRIVILEGES ON {{database_name}}.* TO '{{database_username}}'@'%';\""
cmd: "docker exec {{capplications.mariadb.hostname }} mariadb -u root -p{{ applications.mariadb.credentials.root_password }} -e \"GRANT ALL PRIVILEGES ON {{database_name}}.* TO '{{database_username}}'@'%';\""
args:
executable: /bin/bash

View File

@@ -0,0 +1 @@
version: "latest"