xoxys.postgres/tasks/post_tasks.yml

20 lines
529 B
YAML
Raw Normal View History

2018-10-15 22:07:17 +00:00
---
- name: Ensure PostgreSQL is up and running
service:
name: "{{ postgresql-10 }}"
state: started
enabled: yes
become: True
become_user: root
- name: Check if database is initialized
stat:
path: "{{ postgresql_data_dir }}/PG_VERSION"
register: pgdata_dir_version
- name: Ensure database is initialized
command: "/usr/pgsql-{{ __postgres_version }}/bin/postgresql-{{ __postgres_version }}-setup initdb"
when: not pgdata_dir_version.stat.exists
become: true
become_user: "{{ postgres_user }}"