2018-05-02 15:54:53 +02:00
|
|
|
{%- from salt.file.dirname(tpldir) ~ "/map.jinja" import postgres with context -%}
|
2016-09-26 13:57:55 +03:00
|
|
|
|
|
|
|
{%- 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
|
|
|
|
2018-03-08 12:30:25 +00:00
|
|
|
{%- if postgres.use_upstream_repo == true %}
|
2015-04-21 15:13:42 -07:00
|
|
|
include:
|
|
|
|
- postgres.upstream
|
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 }}
|
2018-03-08 12:30:25 +00:00
|
|
|
{%- if postgres.use_upstream_repo == true %}
|
2016-09-26 13:57:55 +03:00
|
|
|
- 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
|
|
|
|
2018-01-14 16:12:17 +00:00
|
|
|
# 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) %}
|
2016-09-26 13:57:55 +03:00
|
|
|
|
2018-03-31 21:56:58 +01:00
|
|
|
postgresql-{{ bin }}-altinstall:
|
2016-09-26 13:57:55 +03:00
|
|
|
alternatives.install:
|
2018-03-31 21:56:58 +01:00
|
|
|
- name: {{ bin }}
|
2016-09-26 13:57:55 +03:00
|
|
|
- link: {{ salt['file.join']('/usr/bin', bin) }}
|
|
|
|
- path: {{ path }}
|
2018-01-14 16:12:17 +00:00
|
|
|
- priority: {{ postgres.linux.altpriority }}
|
2016-09-26 13:57:55 +03:00
|
|
|
- onlyif: test -f {{ path }}
|
|
|
|
- require:
|
|
|
|
- pkg: postgresql-client-libs
|
|
|
|
|
2018-01-14 16:12:17 +00:00
|
|
|
{%- endfor %}
|
2016-09-26 13:57:55 +03:00
|
|
|
{%- endif %}
|