blob: 865f111a3a38c75023886be457a2e8cdde0f6ca6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
---
- name: install postgresql
become: yes
apt: name="{{postgresql_apt_packages}}"
- name: configure postgresql data dir
become: yes
lineinfile:
path: "{{postgresql_config_path}}"
regexp: "^data_directory = "
line: "data_directory = '{{postgresql_data_dir}}'"
notify: restart postgres
- name: create postgresql data dir
become: yes
file:
path: "{{postgresql_data_dir}}"
state: "directory"
mode: "0700"
owner: "postgres"
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"
|