infra/home/ansible/check-postgres.yml
2025-09-06 10:55:13 -05:00

29 lines
No EOL
878 B
YAML

---
- name: Check PostgreSQL configuration
hosts: proxmox
become: yes
gather_facts: no
vars:
ct_id: 300
tasks:
- name: Find PostgreSQL version and config location
shell: |
pct exec {{ ct_id }} -- bash -c "
# Check if PostgreSQL is installed
which psql || echo 'psql not found'
# Find PostgreSQL version
dpkg -l | grep postgresql-[0-9] | grep -v client || echo 'PostgreSQL package not found'
# Find pg_hba.conf location
find /etc -name pg_hba.conf 2>/dev/null || echo 'pg_hba.conf not found'
# Check if PostgreSQL is running
systemctl status postgresql --no-pager || echo 'PostgreSQL service not found'
"
register: postgres_info
- name: Display PostgreSQL information
debug:
msg: "{{ postgres_info.stdout_lines }}"