mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-12-09 10:56:01 +00:00
Upercased MariaDB variables
This commit is contained in:
@@ -1,27 +1,27 @@
|
|||||||
- name: "Setup docker network for {{ application_id }}"
|
- name: "Setup docker network for {{ application_id }}"
|
||||||
include_tasks: "{{ [playbook_dir, 'roles/docker-compose/tasks/utils/network.yml' ] | path_join }}"
|
include_tasks: "{{ [playbook_dir, 'roles/docker-compose/tasks/utils/network.yml' ] | path_join }}"
|
||||||
vars:
|
vars:
|
||||||
docker_network_name: "{{ mariadb_network }}"
|
docker_network_name: "{{ MARIADB_NETWORK }}"
|
||||||
docker_network_subnet: "{{ mariadb_subnet }}"
|
docker_network_subnet: "{{ MARIADB_SUBNET }}"
|
||||||
|
|
||||||
- name: install MariaDB
|
- name: install MariaDB
|
||||||
community.docker.docker_container:
|
community.docker.docker_container:
|
||||||
name: "{{ mariadb_name }}"
|
name: "{{ MARIADB_NAME }}"
|
||||||
image: "{{ mariadb_image }}:{{ mariadb_version}}"
|
image: "{{ MARIADB_IMAGE }}:{{ MARIADB_VERSION}}"
|
||||||
detach: yes
|
detach: yes
|
||||||
env:
|
env:
|
||||||
MARIADB_ROOT_PASSWORD: "{{ mariadb_root_pwd }}"
|
MARIADB_ROOT_PASSWORD: "{{ MARIADB_ROOT_PWD }}"
|
||||||
MARIADB_AUTO_UPGRADE: "1"
|
MARIADB_AUTO_UPGRADE: "1"
|
||||||
networks:
|
networks:
|
||||||
- name: "{{ mariadb_network }}"
|
- name: "{{ MARIADB_NETWORK }}"
|
||||||
volumes:
|
volumes:
|
||||||
- "{{ mariadb_volume }}:/var/lib/mysql"
|
- "{{ MARIADB_VOLUME }}:/var/lib/mysql"
|
||||||
published_ports:
|
published_ports:
|
||||||
- "127.0.0.1:{{ mariadb_port }}:3306" # can be that this will be removed if all applications use sockets
|
- "127.0.0.1:{{ MARIADB_PORT }}:3306" # can be that this will be removed if all applications use sockets
|
||||||
command: "--transaction-isolation=READ-COMMITTED --binlog-format=ROW" #for nextcloud
|
command: "--transaction-isolation=READ-COMMITTED --binlog-format=ROW" #for nextcloud
|
||||||
restart_policy: "{{ DOCKER_RESTART_POLICY }}"
|
restart_policy: "{{ DOCKER_RESTART_POLICY }}"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: "/usr/bin/mariadb --user=root --password={{ mariadb_root_pwd }} --execute \"SHOW DATABASES;\""
|
test: "/usr/bin/mariadb --user=root --password={{ MARIADB_ROOT_PWD }} --execute \"SHOW DATABASES;\""
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 18
|
retries: 18
|
||||||
@@ -32,9 +32,9 @@
|
|||||||
name: python-mysqlclient
|
name: python-mysqlclient
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
- name: "Wait until the MariaDB container with hostname '{{ mariadb_name }}' is healthy"
|
- name: "Wait until the MariaDB container with hostname '{{ MARIADB_NAME }}' is healthy"
|
||||||
community.docker.docker_container_info:
|
community.docker.docker_container_info:
|
||||||
name: "{{ mariadb_name }}"
|
name: "{{ MARIADB_NAME }}"
|
||||||
register: db_info
|
register: db_info
|
||||||
until:
|
until:
|
||||||
- db_info.container is defined
|
- db_info.container is defined
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
name: "{{ database_name }}"
|
name: "{{ database_name }}"
|
||||||
state: present
|
state: present
|
||||||
login_user: root
|
login_user: root
|
||||||
login_password: "{{ mariadb_root_pwd }}"
|
login_password: "{{ MARIADB_ROOT_PWD }}"
|
||||||
login_host: 127.0.0.1
|
login_host: 127.0.0.1
|
||||||
login_port: "{{ database_port }}"
|
login_port: "{{ database_port }}"
|
||||||
encoding: "{{ database_encoding }}"
|
encoding: "{{ database_encoding }}"
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
priv: '{{ database_name }}.*:ALL'
|
priv: '{{ database_name }}.*:ALL'
|
||||||
state: present
|
state: present
|
||||||
login_user: root
|
login_user: root
|
||||||
login_password: "{{mariadb_root_pwd}}"
|
login_password: "{{MARIADB_ROOT_PWD}}"
|
||||||
login_host: 127.0.0.1
|
login_host: 127.0.0.1
|
||||||
login_port: "{{ database_port }}"
|
login_port: "{{ database_port }}"
|
||||||
|
|
||||||
@@ -25,6 +25,6 @@
|
|||||||
# @todo Remove if this works fine in the future.
|
# @todo Remove if this works fine in the future.
|
||||||
#- name: Grant database privileges
|
#- name: Grant database privileges
|
||||||
# ansible.builtin.shell:
|
# ansible.builtin.shell:
|
||||||
# cmd: "docker exec {{mariadb_name }} mariadb -u root -p{{ mariadb_root_pwd }} -e \"GRANT ALL PRIVILEGES ON `{{ database_name }}`.* TO '{{ database_username }}'@'%';\""
|
# cmd: "docker exec {{MARIADB_NAME }} mariadb -u root -p{{ MARIADB_ROOT_PWD }} -e \"GRANT ALL PRIVILEGES ON `{{ database_name }}`.* TO '{{ database_username }}'@'%';\""
|
||||||
# args:
|
# args:
|
||||||
# executable: /bin/bash
|
# executable: /bin/bash
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
application_id: svc-db-mariadb
|
application_id: svc-db-mariadb
|
||||||
mariadb_root_pwd: "{{ applications | get_app_conf(application_id,'credentials.root_password') }}"
|
MARIADB_ROOT_PWD: "{{ applications | get_app_conf(application_id,'credentials.root_password') }}"
|
||||||
mariadb_subnet: "{{ networks.local['svc-db-mariadb'].subnet }}"
|
MARIADB_SUBNET: "{{ networks.local['svc-db-mariadb'].subnet }}"
|
||||||
mariadb_network: "{{ applications | get_app_conf(application_id,'docker.network') }}"
|
MARIADB_NETWORK: "{{ applications | get_app_conf(application_id,'docker.network') }}"
|
||||||
mariadb_volume: "{{ applications | get_app_conf(application_id,'docker.volumes.data') }}"
|
MARIADB_VOLUME: "{{ applications | get_app_conf(application_id,'docker.volumes.data') }}"
|
||||||
mariadb_image: "{{ applications | get_app_conf(application_id,'docker.services.mariadb.image','mariadb') }}"
|
MARIADB_IMAGE: "{{ applications | get_app_conf(application_id,'docker.services.mariadb.image','mariadb') }}"
|
||||||
mariadb_version: "{{ applications | get_app_conf(application_id,'docker.services.mariadb.version') }}"
|
MARIADB_VERSION: "{{ applications | get_app_conf(application_id,'docker.services.mariadb.version') }}"
|
||||||
mariadb_name: "{{ applications | get_app_conf(application_id,'docker.services.mariadb.name') }}"
|
MARIADB_NAME: "{{ applications | get_app_conf(application_id,'docker.services.mariadb.name') }}"
|
||||||
mariadb_port: "{{ database_port | default(ports.localhost.database[ application_id ]) }}"
|
MARIADB_PORT: "{{ database_port | default(ports.localhost.database[ application_id ]) }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user