33 lines
566 B
YAML
33 lines
566 B
YAML
---
|
|
- name: Install postgresql
|
|
become: yes
|
|
apt:
|
|
pkg:
|
|
- acl
|
|
- postgresql
|
|
- python3-psycopg2
|
|
|
|
- name: Start postgresql service
|
|
become: true
|
|
service:
|
|
name: postgresql
|
|
enabled: yes
|
|
state: started
|
|
|
|
- name: Create postgresql db
|
|
become: true
|
|
become_user: postgres
|
|
postgresql_db:
|
|
name: "{{database}}"
|
|
when: database != false
|
|
|
|
- name: Create postgresql user
|
|
when: username != false
|
|
become: true
|
|
become_user: postgres
|
|
postgresql_user:
|
|
db: "{{database}}"
|
|
name: "{{username}}"
|
|
password: "{{password}}"
|
|
|
|
|