2016-09-26 13:57:55 +03:00
|
|
|
{%- 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 %}
|
2016-10-20 12:23:40 +03:00
|
|
|
{%- endfor %}
|
2016-09-26 13:57:55 +03:00
|
|
|
|
2016-10-20 12:23:40 +03:00
|
|
|
{%- if postgres.use_upstream_repo %}
|
2015-04-21 13:06:41 -07:00
|
|
|
|
2015-04-21 15:13:42 -07:00
|
|
|
include:
|
|
|
|
- postgres.upstream
|
2015-04-21 13:06:41 -07:00
|
|
|
|
2016-09-26 13:57:55 +03:00
|
|
|
{%- endif %}
|
|
|
|
|
2016-10-04 14:38:21 +03:00
|
|
|
# Install PostgreSQL client and libraries
|
|
|
|
|
2016-09-26 13:57:55 +03:00
|
|
|
postgresql-client-libs:
|
2015-04-21 13:06:41 -07:00
|
|
|
pkg.installed:
|
2016-09-26 13:57:55 +03:00
|
|
|
- pkgs: {{ pkgs }}
|
|
|
|
{%- if postgres.use_upstream_repo %}
|
|
|
|
- refresh: True
|
2016-09-22 11:22:24 +10:00
|
|
|
- require:
|
2016-09-26 13:57:55 +03:00
|
|
|
- pkgrepo: postgresql-repo
|
2016-09-22 11:22:24 +10:00
|
|
|
{%- endif %}
|
2015-04-21 13:06:41 -07:00
|
|
|
|
2016-09-26 13:57:55 +03:00
|
|
|
{%- 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 %}
|