From 7d8b7dd00f4080f662ec76a9671bb903d5c45927 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Sat, 6 Jan 2024 14:32:49 +0100 Subject: [PATCH] Renamed databasename --- roles/backup-docker-to-local/tasks/main.yml | 6 +++--- roles/docker-akaunting/templates/run.env.j2 | 2 +- roles/docker-baserow/templates/env.j2 | 2 +- roles/docker-bigbluebutton/vars/main.yml | 2 +- roles/docker-discourse/templates/app.yml.j2 | 2 +- roles/docker-gitea/templates/docker-compose.yml.j2 | 2 +- roles/docker-gitlab/README.md | 2 +- .../docker-gitlab/templates/docker-compose.yml.j2 | 2 +- .../docker-joomla/templates/docker-compose.yml.j2 | 2 +- roles/docker-listmonk/templates/config.toml.j2 | 2 +- roles/docker-mailu/templates/mailu.env.j2 | 4 ++-- roles/docker-mariadb/README.md | 2 +- roles/docker-mariadb/tasks/main.yml | 6 +++--- roles/docker-mastodon/templates/.env.production.j2 | 2 +- .../docker-matomo/templates/docker-compose.yml.j2 | 2 +- .../templates/homeserver.yaml.j2 | 2 +- .../templates/docker-compose.yml.j2 | 2 +- roles/docker-openproject/templates/env.j2 | 2 +- roles/docker-peertube/templates/env.j2 | 2 +- roles/docker-pixelfed/templates/env.j2 | 2 +- roles/docker-postgres/README.md | 2 +- roles/docker-postgres/tasks/main.yml | 14 +++++++------- .../templates/docker-compose.yml.j2 | 2 +- .../docker-yourls/templates/docker-compose.yml.j2 | 2 +- templates/docker-service-mariadb.yml.j2 | 2 +- templates/docker-service-postgres.yml.j2 | 4 ++-- vars/docker-database-service.yml.j2 | 2 +- 27 files changed, 39 insertions(+), 39 deletions(-) diff --git a/roles/backup-docker-to-local/tasks/main.yml b/roles/backup-docker-to-local/tasks/main.yml index 9cbedb28..b069918e 100644 --- a/roles/backup-docker-to-local/tasks/main.yml +++ b/roles/backup-docker-to-local/tasks/main.yml @@ -49,11 +49,11 @@ - name: seed database values command: - cmd: "python database_entry_seeder.py databases.csv {{database_instance}} {{database_databasename}} {{database_username}} {{database_password}}" + cmd: "python database_entry_seeder.py databases.csv {{database_instance}} {{database_name}} {{database_username}} {{database_password}}" chdir: "{{backup_docker_to_local_folder}}" when: > database_host is defined or - database_databasename is defined or + database_name is defined or database_username is defined or database_password is defined @@ -65,7 +65,7 @@ group: root when: > (database_host is defined or - database_databasename is defined or + database_name is defined or database_username is defined or database_password is defined) and run_once_backup_docker_to_local_file_permission is not defined diff --git a/roles/docker-akaunting/templates/run.env.j2 b/roles/docker-akaunting/templates/run.env.j2 index df2aea59..4f524ab8 100644 --- a/roles/docker-akaunting/templates/run.env.j2 +++ b/roles/docker-akaunting/templates/run.env.j2 @@ -6,7 +6,7 @@ LOCALE=en-US DB_HOST={{database_host}} # Change these to match env/db.env -DB_DATABASE={{database_databasename}} +DB_DATABASE={{database_name}} DB_USERNAME={{database_username}} DB_PASSWORD={{database_password}} diff --git a/roles/docker-baserow/templates/env.j2 b/roles/docker-baserow/templates/env.j2 index cd4fe8f3..1887ec2f 100644 --- a/roles/docker-baserow/templates/env.j2 +++ b/roles/docker-baserow/templates/env.j2 @@ -10,7 +10,7 @@ EMAIL_SMTP_PASSWORD={{ system_email_password }} EMAIL_SMTP_USE_TLS={{ system_email_tls | upper }} DATABASE_USER={{ database_username }} -DATABASE_NAME={{ database_databasename }} +DATABASE_NAME={{ database_name }} DATABASE_HOST={{ database_host }} DATABASE_PORT=5432 DATABASE_PASSWORD={{ database_password }} diff --git a/roles/docker-bigbluebutton/vars/main.yml b/roles/docker-bigbluebutton/vars/main.yml index 858520ac..2032507c 100644 --- a/roles/docker-bigbluebutton/vars/main.yml +++ b/roles/docker-bigbluebutton/vars/main.yml @@ -1,6 +1,6 @@ docker_compose_project_name: "bigbluebutton" database_host: "postgres" # needs to be fixed -database_databasename: "greenlight-v3" +database_name: "greenlight-v3" database_username: "postgres" database_password: "" database_type: "postgres" \ No newline at end of file diff --git a/roles/docker-discourse/templates/app.yml.j2 b/roles/docker-discourse/templates/app.yml.j2 index a6e4647c..9c9d4c1b 100644 --- a/roles/docker-discourse/templates/app.yml.j2 +++ b/roles/docker-discourse/templates/app.yml.j2 @@ -67,7 +67,7 @@ env: DISCOURSE_DB_USERNAME: {{ database_username }} DISCOURSE_DB_PASSWORD: {{ database_password }} DISCOURSE_DB_HOST: {{ database_host }} - DISCOURSE_DB_NAME: {{ database_databasename }} + DISCOURSE_DB_NAME: {{ database_name }} # Redis Configuration DISCOURSE_REDIS_HOST: {{docker_compose_project_name}}-redis diff --git a/roles/docker-gitea/templates/docker-compose.yml.j2 b/roles/docker-gitea/templates/docker-compose.yml.j2 index 884a5921..0d05c2dc 100644 --- a/roles/docker-gitea/templates/docker-compose.yml.j2 +++ b/roles/docker-gitea/templates/docker-compose.yml.j2 @@ -14,7 +14,7 @@ services: - USER_GID=1000 - DB_TYPE=mysql - DB_HOST={{database_host}}:3306 - - DB_NAME={{database_databasename}} + - DB_NAME={{database_name}} - DB_USER={{database_username}} - DB_PASSWD={{database_password}} - SSH_PORT={{ssh_port}} diff --git a/roles/docker-gitlab/README.md b/roles/docker-gitlab/README.md index 0b0536be..b802dd92 100644 --- a/roles/docker-gitlab/README.md +++ b/roles/docker-gitlab/README.md @@ -16,7 +16,7 @@ This Ansible role is designed for setting up and managing a GitLab server runnin ## Role Variables Variables are defined in `vars/main.yml`. Key variables include: - `docker_compose_instance_directory`: Directory for Docker Compose instances. -- `docker_compose_project_name`, `database_host`, `database_databasename`, `database_username`, `database_password`: Database configuration variables. +- `docker_compose_project_name`, `database_host`, `database_name`, `database_username`, `database_password`: Database configuration variables. ## Handlers - `recreate gitlab`: Restarts GitLab using Docker Compose when changes are detected. diff --git a/roles/docker-gitlab/templates/docker-compose.yml.j2 b/roles/docker-gitlab/templates/docker-compose.yml.j2 index 5a8bbfd5..b9f177a2 100644 --- a/roles/docker-gitlab/templates/docker-compose.yml.j2 +++ b/roles/docker-gitlab/templates/docker-compose.yml.j2 @@ -20,7 +20,7 @@ services: gitlab_rails['db_port'] = 5432 gitlab_rails['db_username'] = '{{database_username}}' gitlab_rails['db_password'] = '{{database_password}}' - gitlab_rails['db_database'] = "{{database_databasename}}" + gitlab_rails['db_database'] = "{{database_name}}" nginx['listen_port'] = 80 nginx['listen_https'] = false diff --git a/roles/docker-joomla/templates/docker-compose.yml.j2 b/roles/docker-joomla/templates/docker-compose.yml.j2 index 4f9534ca..0dc88ec0 100644 --- a/roles/docker-joomla/templates/docker-compose.yml.j2 +++ b/roles/docker-joomla/templates/docker-compose.yml.j2 @@ -12,7 +12,7 @@ services: JOOMLA_DB_HOST: "{{database_host}}:3306" JOOMLA_DB_USER: "{{database_username}}" JOOMLA_DB_PASSWORD: "{{database_password}}" - JOOMLA_DB_NAME: "{{database_databasename}}" + JOOMLA_DB_NAME: "{{database_name}}" restart: always volumes: - data:/var/www/html diff --git a/roles/docker-listmonk/templates/config.toml.j2 b/roles/docker-listmonk/templates/config.toml.j2 index 1901ae89..dcc9189d 100644 --- a/roles/docker-listmonk/templates/config.toml.j2 +++ b/roles/docker-listmonk/templates/config.toml.j2 @@ -20,7 +20,7 @@ user = "{{database_username}}" password = "{{database_password}}" # Ensure that this database has been created in Postgres. -database = "{{database_databasename}}" +database = "{{database_name}}" ssl_mode = "disable" max_open = 25 diff --git a/roles/docker-mailu/templates/mailu.env.j2 b/roles/docker-mailu/templates/mailu.env.j2 index b52a7f4a..530b23e6 100644 --- a/roles/docker-mailu/templates/mailu.env.j2 +++ b/roles/docker-mailu/templates/mailu.env.j2 @@ -143,11 +143,11 @@ DB_FLAVOR=mysql DB_USER={{database_username}} DB_PW={{database_password}} DB_HOST={{database_host}}:3306 -DB_NAME={{database_databasename}} +DB_NAME={{database_name}} ROUNDCUBE_DB_FLAVOR=mysql ROUNDCUBE_DB_USER={{database_username}} ROUNDCUBE_DB_PW={{database_password}} -ROUNDCUBE_DB_NAME={{database_databasename}} +ROUNDCUBE_DB_NAME={{database_name}} ROUNDCUBE_DB_HOST={{database_host}}:3306 diff --git a/roles/docker-mariadb/README.md b/roles/docker-mariadb/README.md index f30f189d..cb6f9f78 100644 --- a/roles/docker-mariadb/README.md +++ b/roles/docker-mariadb/README.md @@ -19,7 +19,7 @@ Before using this role, ensure you have the following: ## Configuration Configure the role by setting the required variables. These can be set in the playbook or in a separate variable file: - `central_mariadb_root_password`: The root password for the MariaDB server. -- `database_databasename`: The name of the initial database to create. +- `database_name`: The name of the initial database to create. - `database_username`: The username for the database user. - `database_password`: The password for the database user. diff --git a/roles/docker-mariadb/tasks/main.yml b/roles/docker-mariadb/tasks/main.yml index fc3112b0..0802aa5d 100644 --- a/roles/docker-mariadb/tasks/main.yml +++ b/roles/docker-mariadb/tasks/main.yml @@ -46,9 +46,9 @@ timeout: 300 when: run_once_docker_mariadb is not defined -- name: "Create database: {{ database_databasename }}" +- name: "Create database: {{ database_name }}" mysql_db: - name: "{{ database_databasename }}" + name: "{{ database_name }}" state: present login_user: root login_password: "{{ central_mariadb_root_password }}" @@ -60,7 +60,7 @@ name: "{{database_username}}" password: "{{database_password}}" host: "%" - priv: '{{database_databasename}}.*:ALL' + priv: '{{database_name}}.*:ALL' state: present login_user: root login_password: "{{central_mariadb_root_password}}" diff --git a/roles/docker-mastodon/templates/.env.production.j2 b/roles/docker-mastodon/templates/.env.production.j2 index ee838f84..44f619b8 100644 --- a/roles/docker-mastodon/templates/.env.production.j2 +++ b/roles/docker-mastodon/templates/.env.production.j2 @@ -8,7 +8,7 @@ VAPID_PUBLIC_KEY={{mastodon_vapid_public_key}} DB_HOST={{database_host}} DB_PORT=5432 -DB_NAME={{database_databasename}} +DB_NAME={{database_name}} DB_USER={{database_username}} DB_PASS={{database_password}} diff --git a/roles/docker-matomo/templates/docker-compose.yml.j2 b/roles/docker-matomo/templates/docker-compose.yml.j2 index 862f7bed..84bb0044 100644 --- a/roles/docker-matomo/templates/docker-compose.yml.j2 +++ b/roles/docker-matomo/templates/docker-compose.yml.j2 @@ -16,7 +16,7 @@ services: MATOMO_DATABASE_ADAPTER: "mysql" MATOMO_DATABASE_USERNAME: "{{database_username}}" MATOMO_DATABASE_PASSWORD: "{{database_password}}" - MATOMO_DATABASE_DBNAME: "{{database_databasename}}" + MATOMO_DATABASE_DBNAME: "{{database_name}}" volumes: - data:/var/www/html {% include 'templates/docker-container-depends-on-just-database.yml.j2' %} diff --git a/roles/docker-matrix-compose/templates/homeserver.yaml.j2 b/roles/docker-matrix-compose/templates/homeserver.yaml.j2 index d77549e9..962348cc 100644 --- a/roles/docker-matrix-compose/templates/homeserver.yaml.j2 +++ b/roles/docker-matrix-compose/templates/homeserver.yaml.j2 @@ -13,7 +13,7 @@ database: args: user: "{{database_username}}" password: "{{database_password}}" - database: "{{database_databasename}}" + database: "{{database_name}}" host: "{{database_host}}" cp_min: 5 cp_max: 10 diff --git a/roles/docker-nextcloud/templates/docker-compose.yml.j2 b/roles/docker-nextcloud/templates/docker-compose.yml.j2 index 21a62571..6d0ca075 100644 --- a/roles/docker-nextcloud/templates/docker-compose.yml.j2 +++ b/roles/docker-nextcloud/templates/docker-compose.yml.j2 @@ -14,7 +14,7 @@ services: volumes: - data:/var/www/html environment: - MYSQL_DATABASE: "{{database_databasename}}" + MYSQL_DATABASE: "{{database_name}}" MYSQL_USER: "{{database_username}}" MYSQL_PASSWORD: "{{database_password}}" MYSQL_HOST: {{database_host}}:3306 diff --git a/roles/docker-openproject/templates/env.j2 b/roles/docker-openproject/templates/env.j2 index 6b1b2aca..1e91cdac 100644 --- a/roles/docker-openproject/templates/env.j2 +++ b/roles/docker-openproject/templates/env.j2 @@ -13,6 +13,6 @@ PORT=127.0.0.1:{{http_port}} OPENPROJECT_RAILS__RELATIVE__URL__ROOT= IMAP_ENABLED=false POSTGRES_PASSWORD="{{ database_password }}" -DATABASE_URL="postgres://{{ database_username }}:{{ database_password }}@{{database_host}}/{{database_databasename}}?pool=20&encoding=unicode&reconnect=true" +DATABASE_URL="postgres://{{ database_username }}:{{ database_password }}@{{database_host}}/{{database_name}}?pool=20&encoding=unicode&reconnect=true" RAILS_MIN_THREADS=4 RAILS_MAX_THREADS=16 \ No newline at end of file diff --git a/roles/docker-peertube/templates/env.j2 b/roles/docker-peertube/templates/env.j2 index 5119991a..52608ac5 100644 --- a/roles/docker-peertube/templates/env.j2 +++ b/roles/docker-peertube/templates/env.j2 @@ -1,7 +1,7 @@ # Database / Postgres service configuration POSTGRES_USER={{database_username}} POSTGRES_PASSWORD={{peertube_database_password}} -POSTGRES_DB={{database_databasename}} +POSTGRES_DB={{database_name}} PEERTUBE_DB_USERNAME={{database_username}} PEERTUBE_DB_PASSWORD={{peertube_database_password}} PEERTUBE_DB_SSL=false diff --git a/roles/docker-pixelfed/templates/env.j2 b/roles/docker-pixelfed/templates/env.j2 index 10457d2c..8d981862 100644 --- a/roles/docker-pixelfed/templates/env.j2 +++ b/roles/docker-pixelfed/templates/env.j2 @@ -56,7 +56,7 @@ MAIL_ENCRYPTION=tls ## Databases (MySQL) DB_CONNECTION=mysql -DB_DATABASE={{database_databasename}} +DB_DATABASE={{database_name}} DB_HOST={{database_host}} DB_PASSWORD="{{pixelfed_database_password}}" DB_PORT=3306 diff --git a/roles/docker-postgres/README.md b/roles/docker-postgres/README.md index 286d7e22..d8951d84 100644 --- a/roles/docker-postgres/README.md +++ b/roles/docker-postgres/README.md @@ -5,7 +5,7 @@ This Ansible role is designed to deploy a PostgreSQL database using Docker. It i ## Role Variables - `central_postgres_password`: The password for the PostgreSQL superuser (`postgres`). -- `database_databasename`: Name of the database to be created. +- `database_name`: Name of the database to be created. - `database_username`: Username for the database user. - `database_password`: Password for the database user. diff --git a/roles/docker-postgres/tasks/main.yml b/roles/docker-postgres/tasks/main.yml index 5bd22ab1..76acf14f 100644 --- a/roles/docker-postgres/tasks/main.yml +++ b/roles/docker-postgres/tasks/main.yml @@ -41,9 +41,9 @@ state: present when: run_once_docker_postgres is not defined -- name: "Create database: {{ database_databasename }}" +- name: "Create database: {{ database_name }}" postgresql_db: - name: "{{ database_databasename }}" + name: "{{ database_name }}" state: present login_user: postgres login_password: "{{ central_postgres_password }}" @@ -54,7 +54,7 @@ postgresql_user: name: "{{ database_username }}" password: "{{ database_password }}" - db: "{{ database_databasename }}" + db: "{{ database_name }}" state: present login_user: postgres login_password: "{{ central_postgres_password }}" @@ -63,7 +63,7 @@ - name: "Set privileges for database user: {{ database_username }}" postgresql_privs: - db: "{{ database_databasename }}" + db: "{{ database_name }}" role: "{{ database_username }}" objs: ALL_IN_SCHEMA privs: ALL @@ -76,7 +76,7 @@ - name: Grant all privileges at the database level postgresql_privs: - db: "{{ database_databasename }}" + db: "{{ database_name }}" role: "{{ database_username }}" privs: ALL type: database @@ -88,7 +88,7 @@ - name: Grant all privileges on all tables in the public schema postgresql_privs: - db: "{{ database_databasename }}" + db: "{{ database_name }}" role: "{{ database_username }}" objs: ALL_IN_SCHEMA privs: ALL @@ -102,7 +102,7 @@ - name: Set comprehensive privileges for user on public schema postgresql_query: - db: "{{ database_databasename }}" + db: "{{ database_name }}" login_user: postgres login_password: "{{ central_postgres_password }}" login_host: 127.0.0.1 diff --git a/roles/docker-wordpress/templates/docker-compose.yml.j2 b/roles/docker-wordpress/templates/docker-compose.yml.j2 index 35ed9229..fe7dad65 100644 --- a/roles/docker-wordpress/templates/docker-compose.yml.j2 +++ b/roles/docker-wordpress/templates/docker-compose.yml.j2 @@ -14,7 +14,7 @@ services: WORDPRESS_DB_HOST: "{{database_host}}:3306" WORDPRESS_DB_USER: "{{database_username}}" WORDPRESS_DB_PASSWORD: "{{database_password}}" - WORDPRESS_DB_NAME: "{{database_databasename}}" + WORDPRESS_DB_NAME: "{{database_name}}" volumes: - data:/var/www/html healthcheck: diff --git a/roles/docker-yourls/templates/docker-compose.yml.j2 b/roles/docker-yourls/templates/docker-compose.yml.j2 index 3dbb7756..16b31103 100644 --- a/roles/docker-yourls/templates/docker-compose.yml.j2 +++ b/roles/docker-yourls/templates/docker-compose.yml.j2 @@ -15,7 +15,7 @@ services: YOURLS_DB_HOST: "{{database_host}}" YOURLS_DB_USER: "{{database_username}}" YOURLS_DB_PASS: "{{database_password}}" - YOURLS_DB_NAME: "{{database_databasename}}" + YOURLS_DB_NAME: "{{database_name}}" YOURLS_SITE: "https://{{domain}}" YOURLS_USER: "{{yourls_user}}" YOURLS_PASS: "{{yourls_user_password}}" diff --git a/templates/docker-service-mariadb.yml.j2 b/templates/docker-service-mariadb.yml.j2 index 48500980..98b6c2a5 100644 --- a/templates/docker-service-mariadb.yml.j2 +++ b/templates/docker-service-mariadb.yml.j2 @@ -7,7 +7,7 @@ image: mariadb restart: always environment: - MYSQL_DATABASE: "{{database_databasename}}" + MYSQL_DATABASE: "{{database_name}}" MYSQL_USER: "{{database_username}}" MYSQL_PASSWORD: "{{database_password}}" MYSQL_ROOT_PASSWORD: "{{database_password}}" diff --git a/templates/docker-service-postgres.yml.j2 b/templates/docker-service-postgres.yml.j2 index 5a6fd545..92b50760 100644 --- a/templates/docker-service-postgres.yml.j2 +++ b/templates/docker-service-postgres.yml.j2 @@ -6,11 +6,11 @@ environment: - POSTGRES_PASSWORD={{database_password}} - POSTGRES_USER={{database_username}} - - POSTGRES_DB={{database_databasename}} + - POSTGRES_DB={{database_name}} - POSTGRES_INITDB_ARGS="--encoding=UTF8 --locale=C" restart: always healthcheck: - test: ["CMD-SHELL", "pg_isready -U {{database_databasename}}"] + test: ["CMD-SHELL", "pg_isready -U {{database_name}}"] interval: 10s timeout: 5s retries: 6 diff --git a/vars/docker-database-service.yml.j2 b/vars/docker-database-service.yml.j2 index 020a9a3d..022ca48c 100644 --- a/vars/docker-database-service.yml.j2 +++ b/vars/docker-database-service.yml.j2 @@ -1,6 +1,6 @@ docker_compose_instance_directory: "{{ path_docker_compose_instances + docker_compose_project_name + '/' }}" database_instance: "{{ 'central-' + database_type if enable_central_database else docker_compose_project_name }}" database_host: "{{ 'central-' + database_type if enable_central_database else 'database' }}" -database_databasename: "{{ docker_compose_project_name }}" +database_name: "{{ docker_compose_project_name }}" database_username: "{{ docker_compose_project_name }}" database_version: "{{ postgres_default_version }}" \ No newline at end of file