Member-only story

Drop a PostgreSQL Database — Ansible module postgresql_db

How to automate the deletion of a “testdb” database on PostgreSQL using Ansible Playbook and postgresql_db module.

Luca Berton
5 min readJun 15, 2022

How to Drop a PostgreSQL Database with Ansible?

I’m going to show you a live demo with some simple Ansible code.

I’m Luca Berton and welcome to today’s episode of Ansible Pilot.

Ansible Drop a PostgreSQL Database

  • `community.postgresql.postgresql_db`
  • Add or remove PostgreSQL databases from a remote host

Let’s talk about the Ansible module `postgresql_db`.

The full name is `community.postgresql.postgresql_db`, which means that is part of the collection of modules “community.postgresql” maintained by the Ansible Community to interact with PostgreSQL.

The collection is tested with `ansible-core` version 2.11+, prior versions such as 2.9 or 2.10 are not supported.

The purpose of the module is to add or remove PostgreSQL databases from a remote host.

--

--

Luca Berton
Luca Berton

Written by Luca Berton

I help creative Automation DevOps, Cloud Engineer, System Administrator, and IT Professional to succeed with Ansible Technology to automate more things everyday

No responses yet