Skip to content

Commit 9ef6bed

Browse files
committed
More fixes for database directory.
1 parent 1429b9f commit 9ef6bed

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,10 @@ script:
4545
# Check PostgreSQL status.
4646
- 'docker exec -u postgres "$(cat ${container_id})" pg_ctl -D /var/lib/pgsql/data status'
4747

48+
after_failure:
49+
# Check what happened on systemd systems.
50+
- 'docker exec --tty "$(cat ${container_id})" env TERM=xterm systemctl -l status postgresql.service'
51+
- 'docker exec --tty "$(cat ${container_id})" env TERM=xterm journalctl -xe --no-pager'
52+
4853
notifications:
4954
webhooks: https://galaxy.ansible.com/api/v1/notifications/

tasks/initialize.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
---
2+
- name: Set PGDATA environment variable.
3+
template:
4+
src: postgres.sh.j2
5+
dest: /etc/profile.d/postgres.sh
6+
mode: 0644
7+
28
- name: Ensure PostgreSQL data directory exists.
39
file:
410
path: "{{ postgresql_data_dir }}"
@@ -14,6 +20,6 @@
1420

1521
- name: Ensure PostgreSQL database is initialized.
1622
command: "initdb -D {{ postgresql_data_dir }}"
17-
when: pgdata_dir_version.stat.exists
23+
when: not pgdata_dir_version.stat.exists
1824
become: yes
1925
become_user: "{{ postgresql_user }}"

templates/postgres.sh.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export PGDATA={{ postgresql_data_dir }}

0 commit comments

Comments
 (0)