feat: install and init postgres

This commit is contained in:
Aravinth Manivannan 2022-12-30 05:17:40 +05:30
parent 057f49c0ad
commit 6cddd76963
Signed by: realaravinth
GPG key ID: AD9F0F08E855ED88

View file

@ -1,7 +1,7 @@
---
- name: Configure webservers
hosts: debainbasic
remote_user: root
remote_user: atm
tasks:
- name: Ensure all VMs are reachable
@ -30,6 +30,9 @@
- dnsutils
- bind9
- python3-setuptools
- postgresql
- postgresql-contrib
- python3-psycopg2
- name: Create /etc/apt/keyrings dir
ansible.builtin.file:
@ -107,6 +110,16 @@
state:
started
- name: "Find out if PostgreSQL is initialized"
ansible.builtin.stat:
path: "/var/lib/pgsql/data/pg_hba.conf"
register: postgres_data
- name: "Start and enable services"
service: "name={{ item }} state=started enabled=yes"
with_items:
- postgresql
# - debug: var=ansible_all_ipv4_addresses
# - debug: var=ansible_default_ipv4.address
@ -115,3 +128,6 @@
ansible.builtin.service:
name: nginx
state: restarted
- name: restart postgres
service: name=postgresql state=restarted