Basic Postgresql Installtion as a Single Node:
---
- name: Install postgres
hosts: localhost
become: true
tasks:
- name: Install postgres
yum:
name:
- postgresql
- postgresql-server
- postgresql-contrib
- postgresql-libs
- python3-psycopg2
state: present
- name: Postgresql initialized or not
stat:
path: /var/lib/pgsql/data/pg_hba.conf
register: result
- name: InitDB
shell: postgresql-setup initdb
when: not result.stat.exists
- name: Open port for postgresql
firewalld:
service: postgresql
permanent: true
state: enabled
notify:
- Reload firewalld
- name : Start service
service: postgresql
state: started
enabled: true
handlers:
- name: Reload firewalld
service: firewalld
state: reloaded
No comments:
Post a Comment