2018-05-02 15:54:53 +02:00
|
|
|
{% from tpldir + "/map.jinja" import postgres with context %}
|
2015-05-05 15:40:49 -07:00
|
|
|
|
2018-03-08 11:41:19 +00:00
|
|
|
{% if grains.os not in ('Windows', 'MacOS',) %}
|
|
|
|
|
|
|
|
{% if postgres.pkg_dev %}
|
2015-05-05 15:40:49 -07:00
|
|
|
install-postgres-dev-package:
|
|
|
|
pkg.installed:
|
|
|
|
- name: {{ postgres.pkg_dev }}
|
2018-04-09 14:59:49 +01:00
|
|
|
{% if postgres.fromrepo %}
|
|
|
|
- fromrepo: {{ postgres.fromrepo }}
|
|
|
|
{% endif %}
|
2018-03-08 11:41:19 +00:00
|
|
|
{% endif %}
|
2015-05-05 15:40:49 -07:00
|
|
|
|
2018-03-08 11:41:19 +00:00
|
|
|
{% if postgres.pkg_libpq_dev %}
|
2015-05-05 15:40:49 -07:00
|
|
|
install-postgres-libpq-dev:
|
|
|
|
pkg.installed:
|
|
|
|
- name: {{ postgres.pkg_libpq_dev }}
|
2018-04-09 14:59:49 +01:00
|
|
|
{% if postgres.fromrepo %}
|
|
|
|
- fromrepo: {{ postgres.fromrepo }}
|
|
|
|
{% endif %}
|
2018-03-08 11:41:19 +00:00
|
|
|
{% endif %}
|
|
|
|
|
2018-03-31 21:56:58 +01:00
|
|
|
# Alternatives system. Make devclient binaries available in $PATH
|
|
|
|
{%- if 'bin_dir' in postgres and postgres.linux.altpriority %}
|
|
|
|
{%- for bin in postgres.dev_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 }}
|
|
|
|
|
|
|
|
{%- endfor %}
|
|
|
|
{%- endif %}
|
|
|
|
|
|
|
|
{% elif grains.os == 'MacOS' %}
|
2018-03-08 11:41:19 +00:00
|
|
|
|
|
|
|
# Darwin maxfiles limits
|
|
|
|
{% if postgres.limits.soft or postgres.limits.hard %}
|
|
|
|
|
|
|
|
postgres_maxfiles_limits_conf:
|
|
|
|
file.managed:
|
|
|
|
- name: /Library/LaunchDaemons/limit.maxfiles.plist
|
2018-05-02 15:54:53 +02:00
|
|
|
- source: salt://{{ tpldir }}/templates/limit.maxfiles.plist
|
2018-03-08 11:41:19 +00:00
|
|
|
- context:
|
|
|
|
soft_limit: {{ postgres.limits.soft or postgres.limits.hard }}
|
|
|
|
hard_limit: {{ postgres.limits.hard or postgres.limits.soft }}
|
2018-03-08 12:30:25 +00:00
|
|
|
- group: {{ postgres.group }}
|
2018-03-08 11:41:19 +00:00
|
|
|
{% endif %}
|
|
|
|
|
2018-03-08 12:30:25 +00:00
|
|
|
{% if postgres.use_upstream_repo == 'postgresapp' %}
|
|
|
|
# Shortcut for PostgresApp
|
2018-03-08 11:41:19 +00:00
|
|
|
postgres-desktop-shortcut-clean:
|
|
|
|
file.absent:
|
2018-03-08 12:30:25 +00:00
|
|
|
- name: '{{ postgres.userhomes }}/{{ postgres.user }}/Desktop/Postgres ({{ postgres.use_upstream_repo }})'
|
2018-03-08 11:41:19 +00:00
|
|
|
- require_in:
|
|
|
|
- file: postgres-desktop-shortcut-add
|
|
|
|
|
|
|
|
postgres-desktop-shortcut-add:
|
|
|
|
file.managed:
|
|
|
|
- name: /tmp/mac_shortcut.sh
|
2018-05-02 15:54:53 +02:00
|
|
|
- source: salt://{{ tpldir }}/templates/mac_shortcut.sh
|
2018-03-08 11:41:19 +00:00
|
|
|
- mode: 755
|
|
|
|
- template: jinja
|
|
|
|
- context:
|
2018-03-08 12:30:25 +00:00
|
|
|
user: {{ postgres.user }}
|
2018-03-08 11:41:19 +00:00
|
|
|
homes: {{ postgres.userhomes }}
|
|
|
|
cmd.run:
|
2018-03-08 12:30:25 +00:00
|
|
|
- name: '/tmp/mac_shortcut.sh "Postgres ({{ postgres.use_upstream_repo }})"'
|
|
|
|
- runas: {{ postgres.user }}
|
2018-03-08 11:41:19 +00:00
|
|
|
- require:
|
|
|
|
- file: postgres-desktop-shortcut-add
|
2018-03-08 12:30:25 +00:00
|
|
|
{% endif %}
|
2018-03-08 11:41:19 +00:00
|
|
|
|
2015-05-05 15:40:49 -07:00
|
|
|
{% endif %}
|