feat: install and init postgres
This commit is contained in:
parent
057f49c0ad
commit
6cddd76963
1 changed files with 17 additions and 1 deletions
18
debian/ansible/playbook.yml
vendored
18
debian/ansible/playbook.yml
vendored
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
- name: Configure webservers
|
- name: Configure webservers
|
||||||
hosts: debainbasic
|
hosts: debainbasic
|
||||||
remote_user: root
|
remote_user: atm
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Ensure all VMs are reachable
|
- name: Ensure all VMs are reachable
|
||||||
|
@ -30,6 +30,9 @@
|
||||||
- dnsutils
|
- dnsutils
|
||||||
- bind9
|
- bind9
|
||||||
- python3-setuptools
|
- python3-setuptools
|
||||||
|
- postgresql
|
||||||
|
- postgresql-contrib
|
||||||
|
- python3-psycopg2
|
||||||
|
|
||||||
- name: Create /etc/apt/keyrings dir
|
- name: Create /etc/apt/keyrings dir
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
|
@ -107,6 +110,16 @@
|
||||||
state:
|
state:
|
||||||
started
|
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_all_ipv4_addresses
|
||||||
# - debug: var=ansible_default_ipv4.address
|
# - debug: var=ansible_default_ipv4.address
|
||||||
|
|
||||||
|
@ -115,3 +128,6 @@
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: nginx
|
name: nginx
|
||||||
state: restarted
|
state: restarted
|
||||||
|
|
||||||
|
- name: restart postgres
|
||||||
|
service: name=postgresql state=restarted
|
||||||
|
|
Loading…
Add table
Reference in a new issue