Files
computer-playbook/roles/svc-db-postgres
kevinveenbirkenbachandClaude Opus 5.5 8f59d4dcff fix(security): keep ansible from expanding $VARs in the bash -c script text
54ea4890e7 moved Nextcloud's admin realignment and the Postgres pg_hba
rescue to ansible.builtin.command with the script text as the `bash -c`
argument. For a list argv the module runs os.path.expandvars over every
item before bash starts (module_utils/basic.py:1979-1981), so any `$NAME`
in the script that also exists in the module's environment was replaced
by Python first. realign_admin_password.sh names its target "$container",
and wherever `container=docker` is set (systemd in docker) the realignment
execed into a container called `docker`.

Both tasks set `expand_argument_vars: false`; bash expands the variables
at runtime from the same environment, as the scripts expect. The other
sites of 54ea4890e7 use `shell:`, whose string path skips this expansion.
feature/updater carries the same flag for its own command sites
(94ed66f1e3).

Reproduced against a stub `container`: with the flag off the script's
"$container" turned into the environment's `docker`, with
`expand_argument_vars: false` it keeps the real id and the secret still
arrives on stdin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 16:57:44 +01:00
..
…
…
…
…

PostgreSQL

Description

This Ansible role deploys and configures a PostgreSQL database in a Docker container using Docker Compose. It is designed to simplify database administration by automating the creation of networks, containers, and essential database tasks (such as database and user creation) for a secure and high-performance environment.

Overview

Built for environments that demand reliability and ease of management, this role:

  • Sets up a dedicated Docker network for PostgreSQL.
  • Deploys a PostgreSQL container with secure configurations and automated healthchecks.
  • Automates tasks like database creation, user setup, and privilege assignments to streamline your workflows.

Purpose

The purpose of this role is to provide an effortless way to deploy a PostgreSQL database via Docker. It minimizes manual interventions while ensuring that your database is configured securely and reliably for both production and development scenarios.

Features

  • Automated Deployment: Installs PostgreSQL with minimal manual steps.
  • Robust Administration: Automatically creates databases, users, and assigns privileges.
  • Enhanced Security: The service is bound to 127.0.0.1:5432, restricting access and enhancing security.
  • Seamless Docker Integration: Works harmoniously with Docker Compose and other roles in your infrastructure.
  • Automatic Major Upgrades: Detects an older cluster in the data volume and upgrades it major by major with pg_upgrade --link, see Upgrade.md.