diff --git a/postgres/defaults.yaml b/postgres/defaults.yaml index 71f473d..e2670bf 100644 --- a/postgres/defaults.yaml +++ b/postgres/defaults.yaml @@ -2,6 +2,7 @@ postgres: use_upstream_repo: True + add_path: False # add bin_dir to $PATH, if installed from repos version: '10' pkg: postgresql pkgs_extra: [] diff --git a/postgres/templates/postgres.sh.j2 b/postgres/templates/postgres.sh.j2 new file mode 100644 index 0000000..3d074fa --- /dev/null +++ b/postgres/templates/postgres.sh.j2 @@ -0,0 +1,3 @@ +if ! echo $PATH | grep -q {{ bin_dir }} ; then + export PATH=$PATH:{{ bin_dir }} +fi diff --git a/postgres/upstream.sls b/postgres/upstream.sls index 45605c4..427574d 100644 --- a/postgres/upstream.sls +++ b/postgres/upstream.sls @@ -5,6 +5,18 @@ {%- if postgres.use_upstream_repo == true -%} + {%- if postgres.add_path -%} +postgresql-profile: + file.managed: + - name: /etc/profile.d/postgres.sh + - user: root + - group: root + - mode: 644 + - template: jinja + - source: salt://postgres/templates/postgres.sh.j2 + - defaults: + bin_dir: {{ postgres.bin_dir }} + {%- endif %} # Add upstream repository for your distro postgresql-repo: pkgrepo.managed: