src.nth.io/

summaryrefslogtreecommitdiff
path: root/postgresql/tasks/main.yaml
diff options
context:
space:
mode:
Diffstat (limited to 'postgresql/tasks/main.yaml')
-rw-r--r--postgresql/tasks/main.yaml11
1 files changed, 11 insertions, 0 deletions
diff --git a/postgresql/tasks/main.yaml b/postgresql/tasks/main.yaml
index 6195840..6efa491 100644
--- a/postgresql/tasks/main.yaml
+++ b/postgresql/tasks/main.yaml
@@ -22,6 +22,17 @@
group: "postgres"
notify: restart postgres
+- name: check if postgresql data dir is new
+ become: yes
+ find: path='{{postgresql_data_dir}}'
+ register: filesFound
+
+- name: initialize pg data dir
+ become: yes
+ become_user: "postgres"
+ command: "{{postgresql_initidb_path}} -D {{postgresql_data_dir}}"
+ when: filesFound == 0
+
- name: ensure postgresql is started
become: yes
systemd: name="postgresql" enabled="yes" state="started"