20 lines
529 B
YAML
20 lines
529 B
YAML
---
|
|
- 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 }}"
|