config: add admin.sh wrapper script

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2023-11-21 16:15:43 +01:00
parent bbdb294e3d
commit a38d2c707a
No known key found for this signature in database
GPG Key ID: FE65CD384D5BF7B4
3 changed files with 27 additions and 5 deletions

View File

@ -23,10 +23,14 @@
with_fileglob:
- 'templates/init/*.sql'
- name: 'Create compose file'
- name: Install PostgreSQL client
apt:
name: 'postgresql-client'
- name: Create Admin wrapper script
template:
src: 'docker-compose.yml.j2'
dest: '{{ postgres_ha_compose_file }}'
owner: 'dockremap'
src: 'scripts/admin.sh.j2'
dest: '{{ postgres_ha_service_path }}/admin.sh'
owner: 'root'
group: 'docker'
mode: 0644
mode: 0750

View File

@ -1,4 +1,12 @@
---
- name: 'Create compose file'
template:
src: 'docker-compose.yml.j2'
dest: '{{ postgres_ha_compose_file }}'
owner: 'dockremap'
group: 'docker'
mode: 0644
- name: 'Create database container'
docker_compose:
project_src: '{{ postgres_ha_service_path }}'

View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
# vim: set ft=sh:
set -Eeo pipefail
export PGPASSWORD='{{ postgres_ha_admin_pass }}'
exec psql \
--host='127.0.0.1' \
--port='{{ postgres_ha_cont_port }}' \
--username='{{ postgres_ha_admin_user }}' \
--dbname='{{ postgres_ha_db_name }}' \
${@}