blob: 0be2dffcecbffb02c5a492692dd43128ff2eb032 (
plain) (
tree)
|
|
- name: Test if the PostgreSQL server is up
become: true
become_user: postgres
become_method: "{{ postgres_become_method }}"
command: psql --port={{ postgres_port }} --command='select NOW()'
register: postgres_up
ignore_errors: yes
check_mode: no
changed_when: false
- name: Create PostgreSQL database
become: true
become_user: postgres
become_method: "{{ postgres_become_method }}"
postgresql_db:
port: "{{ postgres_port }}"
name: "{{ postgres_dbname }}"
owner: "{{ postgres_owner }}"
when:
- postgres_up.rc == 0
- name: Create database extensions
include_tasks: postgres-database-extensions.yml
loop: "{{ postgres_extensions| default([]) }}"
loop_control:
loop_var: postgres_extension
when: postgres_up.rc == 0
|