mirror of
https://github.com/saltstack-formulas/postgres-formula.git
synced 2025-04-16 01:30:25 +00:00
RedHat: make client binaries available in $PATH
This commit is contained in:
parent
ea8c88c601
commit
d5dcac95a7
5 changed files with 74 additions and 22 deletions
|
@ -1,21 +1,45 @@
|
||||||
{% from "postgres/map.jinja" import postgres with context %}
|
{%- from "postgres/map.jinja" import postgres with context -%}
|
||||||
|
|
||||||
|
{%- set pkgs = [] %}
|
||||||
|
{%- for pkg in (postgres.pkg_client, postgres.pkg_libpq_dev) %}
|
||||||
|
{%- if pkg %}
|
||||||
|
{%- do pkgs.append(pkg) %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor -%}
|
||||||
|
|
||||||
|
{%- if postgres.use_upstream_repo %}
|
||||||
|
|
||||||
{% if postgres.use_upstream_repo %}
|
|
||||||
include:
|
include:
|
||||||
- postgres.upstream
|
- postgres.upstream
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
install-postgresql-client:
|
|
||||||
pkg.installed:
|
|
||||||
- name: {{ postgres.pkg_client }}
|
|
||||||
- refresh: {{ postgres.use_upstream_repo }}
|
|
||||||
{% if postgres.use_upstream_repo %}
|
|
||||||
- require:
|
|
||||||
- pkgrepo: install-postgresql-repo
|
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
{% if postgres.pkg_libpq_dev %}
|
postgresql-client-libs:
|
||||||
install-postgres-libpq-dev:
|
|
||||||
pkg.installed:
|
pkg.installed:
|
||||||
- name: {{ postgres.pkg_libpq_dev }}
|
- pkgs: {{ pkgs }}
|
||||||
{% endif %}
|
{%- if postgres.use_upstream_repo %}
|
||||||
|
- refresh: True
|
||||||
|
- require:
|
||||||
|
- pkgrepo: postgresql-repo
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
{%- if 'bin_dir' in postgres %}
|
||||||
|
|
||||||
|
# Make client binaries available in $PATH
|
||||||
|
|
||||||
|
{%- for bin in postgres.client_bins %}
|
||||||
|
|
||||||
|
{%- set path = salt['file.join'](postgres.bin_dir, bin) %}
|
||||||
|
|
||||||
|
{{ bin }}:
|
||||||
|
alternatives.install:
|
||||||
|
- link: {{ salt['file.join']('/usr/bin', bin) }}
|
||||||
|
- path: {{ path }}
|
||||||
|
- priority: 30
|
||||||
|
- onlyif: test -f {{ path }}
|
||||||
|
- require:
|
||||||
|
- pkg: postgresql-client-libs
|
||||||
|
|
||||||
|
{%- endfor %}
|
||||||
|
|
||||||
|
{%- endif %}
|
||||||
|
|
|
@ -39,3 +39,30 @@ postgres:
|
||||||
command: service postgresql initdb
|
command: service postgresql initdb
|
||||||
test: test -f /var/lib/pgsql/data/PG_VERSION
|
test: test -f /var/lib/pgsql/data/PG_VERSION
|
||||||
env: {}
|
env: {}
|
||||||
|
|
||||||
|
# Client executables list
|
||||||
|
client_bins:
|
||||||
|
- clusterdb
|
||||||
|
- createdb
|
||||||
|
- createlang
|
||||||
|
- createuser
|
||||||
|
- dropdb
|
||||||
|
- droplang
|
||||||
|
- dropuser
|
||||||
|
- pg_archivecleanup
|
||||||
|
- pg_basebackup
|
||||||
|
- pg_config
|
||||||
|
- pg_dump
|
||||||
|
- pg_dumpall
|
||||||
|
- pg_isready
|
||||||
|
- pg_receivexlog
|
||||||
|
- pg_restore
|
||||||
|
- pg_rewind
|
||||||
|
- pg_test_fsync
|
||||||
|
- pg_test_timing
|
||||||
|
- pg_upgrade
|
||||||
|
- pg_xlogdump
|
||||||
|
- pgbench
|
||||||
|
- psql
|
||||||
|
- reindexdb
|
||||||
|
- vacuumdb
|
||||||
|
|
|
@ -12,13 +12,13 @@ include:
|
||||||
|
|
||||||
### Installation states
|
### Installation states
|
||||||
|
|
||||||
postgresql-installed:
|
postgresql-server:
|
||||||
pkg.installed:
|
pkg.installed:
|
||||||
- name: {{ postgres.pkg }}
|
- name: {{ postgres.pkg }}
|
||||||
- refresh: {{ postgres.use_upstream_repo }}
|
{%- if postgres.use_upstream_repo %}
|
||||||
{% if postgres.use_upstream_repo %}
|
- refresh: True
|
||||||
- require:
|
- require:
|
||||||
- pkgrepo: install-postgresql-repo
|
- pkgrepo: postgresql-repo
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
# make sure the data directory and contents have been initialized
|
# make sure the data directory and contents have been initialized
|
||||||
|
@ -31,7 +31,7 @@ postgresql-cluster-prepared:
|
||||||
- unless:
|
- unless:
|
||||||
- {{ postgres.prepare_cluster.test }}
|
- {{ postgres.prepare_cluster.test }}
|
||||||
- require:
|
- require:
|
||||||
- pkg: postgresql-installed
|
- pkg: postgresql-server
|
||||||
|
|
||||||
postgresql-config-dir:
|
postgresql-config-dir:
|
||||||
file.directory:
|
file.directory:
|
||||||
|
|
|
@ -39,6 +39,7 @@ RedHat:
|
||||||
|
|
||||||
pkg: postgresql{{ release }}-server
|
pkg: postgresql{{ release }}-server
|
||||||
pkg_client: postgresql{{ release }}
|
pkg_client: postgresql{{ release }}
|
||||||
|
bin_dir: /usr/pgsql-{{ repo.version }}/bin
|
||||||
conf_dir: /var/lib/pgsql/{{ repo.version }}/data
|
conf_dir: /var/lib/pgsql/{{ repo.version }}/data
|
||||||
service: postgresql-{{ repo.version }}
|
service: postgresql-{{ repo.version }}
|
||||||
|
|
||||||
|
|
|
@ -6,14 +6,14 @@
|
||||||
{%- if postgres.use_upstream_repo -%}
|
{%- if postgres.use_upstream_repo -%}
|
||||||
|
|
||||||
# Add upstream repository for your distro
|
# Add upstream repository for your distro
|
||||||
install-postgresql-repo:
|
postgresql-repo:
|
||||||
pkgrepo.managed:
|
pkgrepo.managed:
|
||||||
{{- format_kwargs(postgres.pkg_repo) }}
|
{{- format_kwargs(postgres.pkg_repo) }}
|
||||||
|
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
|
|
||||||
# Remove the repo configuration (and GnuPG key) as requested
|
# Remove the repo configuration (and GnuPG key) as requested
|
||||||
remove-postgresql-repo:
|
postgresql-repo:
|
||||||
pkgrepo.absent:
|
pkgrepo.absent:
|
||||||
- name: {{ postgres.pkg_repo.name }}
|
- name: {{ postgres.pkg_repo.name }}
|
||||||
{%- if 'pkg_repo_keyid' in postgres %}
|
{%- if 'pkg_repo_keyid' in postgres %}
|
||||||
|
@ -25,7 +25,7 @@ remove-postgresql-repo:
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
|
|
||||||
# Notify that we don't manage this distro
|
# Notify that we don't manage this distro
|
||||||
install-postgresql-repo:
|
postgresql-repo:
|
||||||
test.show_notification:
|
test.show_notification:
|
||||||
- text: |
|
- text: |
|
||||||
PostgreSQL does not provide package repository for {{ grains['osfinger'] }}
|
PostgreSQL does not provide package repository for {{ grains['osfinger'] }}
|
||||||
|
|
Loading…
Add table
Reference in a new issue