Merge branch 'master' of https://github.com/saltstack-formulas/postgres-formula into alts
This commit is contained in:
41
postgres/client/init.sls
Normal file
41
postgres/client/init.sls
Normal file
@@ -0,0 +1,41 @@
|
||||
{%- 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 == true %}
|
||||
include:
|
||||
- postgres.upstream
|
||||
{%- endif %}
|
||||
|
||||
# Install PostgreSQL client and libraries
|
||||
postgresql-client-libs:
|
||||
pkg.installed:
|
||||
- pkgs: {{ pkgs }}
|
||||
{%- if postgres.use_upstream_repo == true %}
|
||||
- refresh: True
|
||||
- require:
|
||||
- pkgrepo: postgresql-repo
|
||||
{%- endif %}
|
||||
|
||||
# Alternatives system. Make client binaries available in $PATH
|
||||
{%- if 'bin_dir' in postgres and postgres.linux.altpriority %}
|
||||
{%- for bin in postgres.client_bins %}
|
||||
{%- set path = salt['file.join'](postgres.bin_dir, bin) %}
|
||||
|
||||
postgresql-{{ bin }}-altinstall:
|
||||
alternatives.install:
|
||||
- name: {{ bin }}
|
||||
- link: {{ salt['file.join']('/usr/bin', bin) }}
|
||||
- path: {{ path }}
|
||||
- priority: {{ postgres.linux.altpriority }}
|
||||
- onlyif: test -f {{ path }}
|
||||
- require:
|
||||
- pkg: postgresql-client-libs
|
||||
|
||||
{%- endfor %}
|
||||
{%- endif %}
|
||||
Reference in New Issue
Block a user