Premier commit

This commit is contained in:
gitea committed 2026-10-18 16:41:04 +02:00
commit 518c7ab04b
49 files changed
+1120

No files matched your search

+50
View File
@@ -0,0 +1,50 @@
---
- name: Remove Postgres
hosts: Ubuntu
become: yes
vars_files:
- vars.yml
tasks:
- name: PostgreSQL uninstallation (Debian)
apt:
name: "{{ item }}"
state: absent
purge: true
loop:
- postgresql
- postgresql-contrib
- python3-psycopg2
when: (ansible_os_family == "Debian")
- name: PostgreSQL uninstallation (RedHat)
apt:
name: "{{ item }}"
state: absent
purge: true
loop:
- postgresql
- postgresql-server
- python3-psycopg2
# - python3-pip
# - acl # Only for Docker containers
when: (ansible_os_family == "RedHat")
- name: Remove database
ansible.builtin.file:
path: "/var/lib/postgresql"
state: absent
- name: Create timestamp for log file
set_fact:
now: "{{ lookup('pipe', 'date +%Y%m%d-%H:%M:%S') }}"
handlers:
- name: Trace operation into local log file
delegate_to: localhost
ansible.builtin.lineinfile:
create: true
path: /var/log/Ansible.log
line: "{{ now }} - database {{ db_name }} destroyed!"