mirror of
https://github.com/saltstack-formulas/postgres-formula.git
synced 2025-04-16 01:30:25 +00:00
Merge pull request #177 from noelmcloughlin/alternatives
W/A hardcoding of debian alternatives priority
This commit is contained in:
commit
36fb8f48b2
5 changed files with 26 additions and 29 deletions
|
@ -14,6 +14,11 @@ postgres:
|
|||
- postgresql-contrib
|
||||
- postgresql-plpython
|
||||
|
||||
|
||||
#'Alternatives system' priority incremental. 0 disables feature.
|
||||
linux:
|
||||
altpriority: 30
|
||||
|
||||
# POSTGRES
|
||||
# Append the lines under this item to your postgresql.conf file.
|
||||
# Pay attention to indent exactly with 4 spaces for all lines.
|
||||
|
|
|
@ -8,14 +8,11 @@
|
|||
{%- endfor %}
|
||||
|
||||
{%- if postgres.use_upstream_repo %}
|
||||
|
||||
include:
|
||||
- postgres.upstream
|
||||
|
||||
{%- endif %}
|
||||
|
||||
# Install PostgreSQL client and libraries
|
||||
|
||||
postgresql-client-libs:
|
||||
pkg.installed:
|
||||
- pkgs: {{ pkgs }}
|
||||
|
@ -25,23 +22,19 @@ postgresql-client-libs:
|
|||
- pkgrepo: postgresql-repo
|
||||
{%- endif %}
|
||||
|
||||
{%- if 'bin_dir' in postgres %}
|
||||
|
||||
# Make client binaries available in $PATH
|
||||
|
||||
# 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) %}
|
||||
|
||||
{{ bin }}:
|
||||
alternatives.install:
|
||||
- link: {{ salt['file.join']('/usr/bin', bin) }}
|
||||
- path: {{ path }}
|
||||
- priority: 30
|
||||
- priority: {{ postgres.linux.altpriority }}
|
||||
- onlyif: test -f {{ path }}
|
||||
- require:
|
||||
- pkg: postgresql-client-libs
|
||||
|
||||
{%- endfor %}
|
||||
|
||||
{%- endif %}
|
||||
|
|
|
@ -41,3 +41,7 @@ postgres:
|
|||
databases: {}
|
||||
schemas: {}
|
||||
extensions: {}
|
||||
|
||||
linux:
|
||||
#Alternatives system are disabled by a 'altpriority=0' pillar.
|
||||
altpriority:
|
||||
|
|
|
@ -46,7 +46,11 @@ RedHat:
|
|||
command: initdb --pgdata='{{ data_dir }}'
|
||||
test: test -f '{{ data_dir }}/PG_VERSION'
|
||||
|
||||
# Directory containing PostgreSQL client executables
|
||||
# Alternatives system
|
||||
linux:
|
||||
altpriority: 30
|
||||
|
||||
# directory containing PostgreSQL client executables
|
||||
bin_dir: /usr/pgsql-{{ repo.version }}/bin
|
||||
client_bins:
|
||||
- clusterdb
|
||||
|
|
|
@ -9,16 +9,12 @@
|
|||
{%- endif %}
|
||||
|
||||
{%- if includes -%}
|
||||
|
||||
include:
|
||||
{{ includes|yaml(false)|indent(2) }}
|
||||
|
||||
{%- endif %}
|
||||
|
||||
{%- set pkgs = [postgres.pkg] + postgres.pkgs_extra %}
|
||||
|
||||
# Install, configure and start PostgreSQL server
|
||||
|
||||
postgresql-server:
|
||||
pkg.installed:
|
||||
- pkgs: {{ pkgs }}
|
||||
|
@ -28,19 +24,16 @@ postgresql-server:
|
|||
- pkgrepo: postgresql-repo
|
||||
{%- endif %}
|
||||
|
||||
{%- if 'bin_dir' in postgres %}
|
||||
|
||||
# Make server binaries available in $PATH
|
||||
|
||||
# Alternatives system. Make server binaries available in $PATH
|
||||
{%- if 'bin_dir' in postgres and postgres.linux.altpriority %}
|
||||
{%- for bin in postgres.server_bins %}
|
||||
|
||||
{%- set path = salt['file.join'](postgres.bin_dir, bin) %}
|
||||
|
||||
{{ bin }}:
|
||||
alternatives.install:
|
||||
- link: {{ salt['file.join']('/usr/bin', bin) }}
|
||||
- path: {{ path }}
|
||||
- priority: 30
|
||||
- priority: {{ postgres.linux.altpriority }}
|
||||
- onlyif: test -f {{ path }}
|
||||
- require:
|
||||
- pkg: postgresql-server
|
||||
|
@ -48,7 +41,6 @@ postgresql-server:
|
|||
- cmd: postgresql-cluster-prepared
|
||||
|
||||
{%- endfor %}
|
||||
|
||||
{%- endif %}
|
||||
|
||||
postgresql-cluster-prepared:
|
||||
|
@ -138,7 +130,6 @@ postgresql-tablespace-dir-{{ name }}:
|
|||
{%- if not postgres.bake_image %}
|
||||
|
||||
# Start PostgreSQL server using OS init
|
||||
|
||||
postgresql-running:
|
||||
service.running:
|
||||
- name: {{ postgres.service }}
|
||||
|
|
Loading…
Add table
Reference in a new issue