Configure an external database for Ansible Automation Platform
Configure an external database for Ansible Automation Platform Operator to use your own database infrastructure.
Using an external database lets you share and reuse resources and manually manage backups, upgrades, and performance optimizations.
To configure an external database, create Kubernetes secrets with credentials for connecting to the database. The same external database (PostgreSQL instance) can be used for platform gateway, automation controller, automation hub, and Event-Driven Ansible controller as long as the database names are different.
hstore PostgreSQL extension.
Configure an external database for platform gateway on Red Hat Ansible Automation Platform Operator Copy linkLink copied!
There are two scenarios for deploying Ansible Automation Platform with an external database:
Before you begin Copy linkLink copied!
The external database must be a PostgreSQL database that is the version supported by the current release of Ansible Automation Platform. The external postgres instance credentials and connection information must be stored in a secret, which is then set on the platform gateway spec.
Ansible Automation Platform supports PostgreSQL 15 for its managed databases and additionally supports PostgreSQL 15, 16, and 17 for external databases.
If you choose to use an externally managed database with version 16 or 17 you must also rely on external backup and restore processes.
About this task Copy linkLink copied!
| Scenario | Action required |
|---|---|
| Fresh install |
You must specify a single external database instance for the platform to use for the following: * Platform gateway * Automation controller * Automation hub * Event-Driven Ansible * Red Hat Ansible Lightspeed (If enabled) See the aap-configuring-external-db-all-default-components.yml example in the Custom resources section for help with this. If using Red Hat Ansible Lightspeed, use the aap-configuring-external-db-with-lightspeed-enabled.yml example. |
| Existing external database in 2.4 |
Your existing external database remains the same after upgrading but you must specify the For detailed steps, see Upgrading an external database for platform gateway on on Ansible Automation Platform |
To deploy Ansible Automation Platform with an external database, you must first create a Kubernetes secret with credentials for connecting to the database.
By default, the Ansible Automation Platform Operator automatically creates and configures a managed PostgreSQL pod in the same namespace as your Ansible Automation Platform deployment. You can deploy Ansible Automation Platform with an external database instead of the managed PostgreSQL pod that the Ansible Automation Platform Operator automatically creates.
Using an external database lets you share and reuse resources and manually manage backups, upgrades, and performance optimizations.
The same external database (PostgreSQL instance) can be used for both automation hub, automation controller, and platform gateway as long as the database names are different. In other words, you can have multiple databases with different names inside a single PostgreSQL instance.
The following section outlines the steps to configure an external database for your platform gateway on a Ansible Automation Platform Operator.
Procedure Copy linkLink copied!
Configure an external database for automation controller on Red Hat Ansible Automation Platform Operator Copy linkLink copied!
For users who prefer to deploy Ansible Automation Platform with an external database, they can do so by configuring a secret with instance credentials and connection information, then applying it to their cluster using the oc create command.
Before you begin Copy linkLink copied!
The external database must be a PostgreSQL database that is the version supported by the current release of Ansible Automation Platform. The external postgres instance credentials and connection information must be stored in a secret, which is then set on the automation controller spec.
Ansible Automation Platform supports PostgreSQL 15 for its managed databases and additionally supports PostgreSQL 15, 16, and 17 for external databases.
If you choose to use an externally managed database with version 16 or 17 you must also rely on external backup and restore processes.
About this task Copy linkLink copied!
By default, the Ansible Automation Platform Operator automatically creates and configures a managed PostgreSQL pod in the same namespace as your Ansible Automation Platform deployment. You can deploy Ansible Automation Platform with an external database instead of the managed PostgreSQL pod that the Ansible Automation Platform Operator automatically creates.
Using an external database lets you share and reuse resources and manually manage backups, upgrades, and performance optimizations.
The same external database (PostgreSQL instance) can be used for both automation hub, automation controller, and platform gateway as long as the database names are different. In other words, you can have multiple databases with different names inside a single PostgreSQL instance.
The following section outlines the steps to configure an external database for your automation controller on a Ansible Automation Platform Operator.
Procedure Copy linkLink copied!
Configure an external database for automation hub on Red Hat Ansible Automation Platform Operator Copy linkLink copied!
For users who prefer to deploy Ansible Automation Platform with an external database, they can do so by configuring a secret with instance credentials and connection information, then applying it to their cluster using the oc create command.
Before you begin Copy linkLink copied!
The external database must be a PostgreSQL database that is the version supported by the current release of Ansible Automation Platform. The external postgres instance credentials and connection information will need to be stored in a secret, which will then be set on the automation hub spec.
Ansible Automation Platform supports PostgreSQL 15 for its managed databases and additionally supports PostgreSQL 15, 16, and 17 for external databases.
If you choose to use an externally managed database with version 16 or 17 you must also rely on external backup and restore processes.
About this task Copy linkLink copied!
By default, the Ansible Automation Platform Operator automatically creates and configures a managed PostgreSQL pod in the same namespace as your Ansible Automation Platform deployment.
You can choose to use an external database instead if you prefer to use a dedicated node to ensure dedicated resources or to manually manage backups, upgrades, or performance tweaks.
The same external database (PostgreSQL instance) can be used for both automation hub, automation controller, and platform gateway as long as the database names are different. In other words, you can have multiple databases with different names inside a single PostgreSQL instance.
The following section outlines the steps to configure an external database for your automation hub on a Ansible Automation Platform Operator.
Procedure Copy linkLink copied!
Upgrading an external database for platform gateway on Ansible Automation Platform Copy linkLink copied!
To upgrade from Ansible Automation Platform 2.4 to 2.6 with an external database, you must scale down your Operator deployment, upgrade your PostgreSQL, then scale your deployment back up.
Before you begin Copy linkLink copied!
- A 2.4 automation controller and automation hub deployment with an external PostgreSQL 13 database
- A newly provisioned PostgreSQL 15 database for the new platform gateway component
Procedure Copy linkLink copied!
Results Copy linkLink copied!
Enable the hstore extension Copy linkLink copied!
The database migration script uses hstore fields to store information, therefore the hstore extension must be enabled in the automation hub PostgreSQL database.
About this task Copy linkLink copied!
This process is automatic when using the Ansible Automation Platform installer and a managed PostgreSQL server.
If the PostgreSQL database is external, you must enable the hstore extension in the automation hub PostgreSQL database manually before installation.
If the hstore extension is not enabled before installation, a failure raises during database migration.
Procedure Copy linkLink copied!
Troubleshoot an external database Copy linkLink copied!
When upgrading the Ansible Automation Platform Operator you may encounter an error like the following:
About this task Copy linkLink copied!
NotImplementedError: can't parse timestamptz with DateStyle 'Redwood, SHOW_TIME': '18-MAY-23 20:33:55.765755 +00:00'
Errors like this occur when you have an external database with an unexpected DateStyle set. You can refer to the following steps to resolve this issue.