infra/roles/stable/postgresql/tasks/main.yml

33 lines
552 B
YAML
Raw Normal View History

---
- name: Install postgresql
apt:
2020-11-10 23:14:10 +01:00
pkg:
- acl
- postgresql
- python3-psycopg2
2020-11-10 23:14:10 +01:00
- 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}}"