infra/roles/stable/postgresql/tasks/main.yml
2020-11-10 23:14:10 +01:00

32 lines
552 B
YAML

---
- name: Install postgresql
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}}"