roles/postgresq: add post-setup-postgresql.sh
This commit is contained in:
parent
c6a046d485
commit
9bc49e5622
@ -11,3 +11,4 @@
|
||||
namespace: itsm
|
||||
domain: onwalk.net
|
||||
secret: keycloak-tls
|
||||
db_namespace: database
|
||||
|
||||
@ -8,3 +8,4 @@
|
||||
name: postgresql
|
||||
vars:
|
||||
group: master
|
||||
db_namespace: database
|
||||
|
||||
5
playbook/roles/postgresql/files/post-setup-postgresql.sh
Normal file
5
playbook/roles/postgresql/files/post-setup-postgresql.sh
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
export namespace=$1
|
||||
|
||||
export POSTGRES_PASSWORD=$(kubectl get secret --namespace $namespace postgresql -o jsonpath="{.data.postgres-password}" | base64 -d)
|
||||
kubectl run postgresql-client --rm --tty -i --restart='Never' --namespace $namespace --image docker.io/bitnami/postgresql:15.2.0-debian-11-r11 --env="PGPASSWORD=$POSTGRES_PASSWORD" --command -- psql --host postgresql -U postgres -d postgres -p 5432 -w -c "CREATE DATABASE keycloak;"
|
||||
@ -1,6 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
export namespace=$1
|
||||
|
||||
helm repo add bitnami https://charts.bitnami.com/bitnami || echo true
|
||||
helm repo up
|
||||
kubectl create ns database || echo true
|
||||
helm upgrade --install postgresql bitnami/postgresql -n database
|
||||
kubectl create ns $namespace || echo true
|
||||
helm upgrade --install postgresql bitnami/postgresql -n $namespace
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
- name: Setup PostgreSQL Server
|
||||
script: setup-postgresql.sh
|
||||
- name: Install PostgreSQL Server
|
||||
script: files/setup-postgresql.sh {{ db_namespace }}
|
||||
when: inventory_hostname in groups[group]
|
||||
|
||||
- name: Post Setup PostgreSQL Server
|
||||
script: files/post-setup-postgresql.sh {{ db_namespace }}
|
||||
when: inventory_hostname in groups[group]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user