postgres-formula/postgres/dev/init.sls

76 lines
2.3 KiB
Text
Raw Normal View History

2018-08-23 10:31:09 +01:00
{%- from salt.file.dirname(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',) %}
{%- set pkgs = [postgres.pkg_dev, postgres.pkg_libpq_dev] + postgres.pkg_dev_deps %}
2018-03-08 11:41:19 +00:00
{% if pkgs %}
install-postgres-dev-packages:
2015-05-05 15:40:49 -07:00
pkg.installed:
- pkgs: {{ pkgs }}
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
# Alternatives system. Make devclient binaries available in $PATH
2018-03-31 21:56:58 +01:00
{%- 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 }}
2018-07-24 21:44:09 +01:00
{% if grains.os in ('Fedora', 'CentOS',) %} {# bypass bug #}
- onlyif: alternatives --display {{ bin }}
{% else %}
2018-03-31 21:56:58 +01:00
- onlyif: test -f {{ path }}
2018-07-24 21:44:09 +01:00
{% endif %}
2018-03-31 21:56:58 +01:00
{%- 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-08-30 22:27:05 +01:00
- source: salt://{{ tpldir }}/../templates/limit.maxfiles.plist
- template: jinja
2018-03-08 11:41:19 +00:00
- context:
soft_limit: {{ postgres.limits.soft }}
hard_limit: {{ postgres.limits.hard }}
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
- 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 %}