postgres-formula/postgres/client/init.sls

42 lines
1.1 KiB
Text
Raw Normal View History

{%- from salt.file.dirname(tpldir) ~ "/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 %}
2018-03-08 12:30:25 +00:00
{%- if postgres.use_upstream_repo == true %}
include:
- postgres.upstream
{%- endif %}
# Install PostgreSQL client and libraries
postgresql-client-libs:
pkg.installed:
- pkgs: {{ pkgs }}
2018-03-08 12:30:25 +00:00
{%- if postgres.use_upstream_repo == true %}
- refresh: True
2016-09-22 11:22:24 +10:00
- require:
- pkgrepo: postgresql-repo
2016-09-22 11:22:24 +10:00
{%- 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) %}
2018-03-31 21:56:58 +01:00
postgresql-{{ bin }}-altinstall:
alternatives.install:
2018-03-31 21:56:58 +01:00
- 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 %}