More fixes for database directory.

This commit is contained in:
Jeff Geerling 2016-09-29 12:36:57 -05:00
parent 1429b9fa22
commit 9ef6bede6b
3 changed files with 13 additions and 1 deletions

View File

@ -45,5 +45,10 @@ script:
# Check PostgreSQL status.
- 'docker exec -u postgres "$(cat ${container_id})" pg_ctl -D /var/lib/pgsql/data status'
after_failure:
# Check what happened on systemd systems.
- 'docker exec --tty "$(cat ${container_id})" env TERM=xterm systemctl -l status postgresql.service'
- 'docker exec --tty "$(cat ${container_id})" env TERM=xterm journalctl -xe --no-pager'
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/

View File

@ -1,4 +1,10 @@
---
- name: Set PGDATA environment variable.
template:
src: postgres.sh.j2
dest: /etc/profile.d/postgres.sh
mode: 0644
- name: Ensure PostgreSQL data directory exists.
file:
path: "{{ postgresql_data_dir }}"
@ -14,6 +20,6 @@
- name: Ensure PostgreSQL database is initialized.
command: "initdb -D {{ postgresql_data_dir }}"
when: pgdata_dir_version.stat.exists
when: not pgdata_dir_version.stat.exists
become: yes
become_user: "{{ postgresql_user }}"

1
templates/postgres.sh.j2 Normal file
View File

@ -0,0 +1 @@
export PGDATA={{ postgresql_data_dir }}