2020-06-01 06:21:27 +00:00
|
|
|
---
|
|
|
|
# Needs variables:
|
|
|
|
# - site: dict describing the site install (cf group_vars/all/vars.yml)
|
|
|
|
|
2020-06-02 10:54:54 +00:00
|
|
|
- name: "Create database {{ site.postgres_database }} if inexistent"
|
|
|
|
postgresql_db:
|
|
|
|
name: "{{ site.postgres_database }}"
|
|
|
|
state: present
|
|
|
|
become: yes
|
|
|
|
become_user: postgres
|
2020-06-01 06:21:27 +00:00
|
|
|
|
2020-06-02 10:54:54 +00:00
|
|
|
- name: "Add database user {{ site.postgres_username }}@{{ site.subnet_site_ip }} and grant all privileges on {{ site.postgres_database }}"
|
|
|
|
postgresql_user:
|
|
|
|
# Credentials of the new db user
|
|
|
|
name: "{{ site.postgres_username }}"
|
|
|
|
password: "{{ site.postgres_password }}"
|
|
|
|
db: "{{ site.postgres_database }}"
|
|
|
|
priv: ALL
|
|
|
|
# host: "{{ site.subnet_site_ip }}"
|
|
|
|
become: yes
|
|
|
|
become_user: postgres
|