automation/deployer/roles/build/tasks/postgres.yml

21 lines
No EOL
695 B
YAML

---
# Needs variables:
# - site: dict describing the site install (cf group_vars/all/vars.yml)
- name: "Create database {{ site.postgres_database }} if inexistent"
postgresql_db:
name: "{{ site.postgres_database }}"
state: present
become: yes
become_user: postgres
- 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