mirror of
https://github.com/geerlingguy/ansible-role-postgresql.git
synced 2025-04-21 18:12:30 -04:00
More fixes for database directory.
This commit is contained in:
parent
1429b9fa22
commit
9ef6bede6b
3 changed files with 13 additions and 1 deletions
|
@ -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/
|
||||
|
|
|
@ -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
1
templates/postgres.sh.j2
Normal file
|
@ -0,0 +1 @@
|
|||
export PGDATA={{ postgresql_data_dir }}
|
Loading…
Add table
Reference in a new issue