Delete PostgreSQL Database
tasks/common/delete_db.yml drops an application's PostgreSQL database through the PostgreSQL
maintenance connection. Service-specific cleanup tasks load their connection details from Vault,
then supply them to this shared task.
Process
The task:
- Validates the supplied database host, port, maintenance password, and database name.
- Generates a temporary internal-Root-CA client certificate, owned by
root, for the PostgreSQL maintenance user. - Waits for the database server over
verify-fullTLS. - Drops the application database.
- Removes the temporary certificate files and clears the task facts after the drop completes.
Input variables
Each calling service supplies these variables to tasks/common/delete_db.yml:
| Variable | Type | Description |
|---|---|---|
cs_common_delete_db_host | string | PostgreSQL host address. |
cs_common_delete_db_port | int | PostgreSQL port. |
cs_common_delete_db_maintenance_password | string | PostgreSQL maintenance user's password. |
cs_common_delete_db_database | string | Application database name. |
Prerequisites
- The application host must already have the PostgreSQL client installed, see System Patching.