aboutsummaryrefslogblamecommitdiffhomepage
path: root/tasks/postgres-database.yml
blob: c7b09a83a7548fa9e8f463ae0c98a24a5f9376e5 (plain) (tree)



















                                                                   
- name: Test if the PostgreSQL server is up
  become: true
  become_user: postgres
  become_method: su
  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: su
  postgresql_db:
    port:             "{{ postgres_port }}"
    name:             "{{ postgres_dbname }}"
    owner:            "{{ postgres_owner }}"
  when:
    - postgres_up.rc == 0