Set sane defaults when use_upstream_repo and version Pillars are set

This commit is contained in:
Denys Havrysh
2016-09-03 15:15:56 +03:00
parent 6651ddc498
commit 8db04833c2
6 changed files with 83 additions and 44 deletions

View File

@@ -1,13 +1,23 @@
{%- macro ubuntu_block(name, version) %}
{%- if salt['pillar.get']('postgres:use_upstream_repo', False) %}
{%- set version = salt['pillar.get']('postgres:version', '9.5') %}
{%- endif -%}
{{ name }}:
pkg_repo: deb http://apt.postgresql.org/pub/repos/apt/ {{ name }}-pgdg main
pkg: postgresql-{{ version }}
pkg_client: postgresql-client-{{ version }}
conf_dir: /etc/postgresql/{{ version }}/main
prepare_cluster:
command: pg_createcluster {{ version }} main
test: test -f /var/lib/postgresql/{{ version }}/main/PG_VERSION && test -f /etc/postgresql/{{ version }}/main/postgresql.conf
user: root
env: {}
{%- endmacro %}
{%- endmacro -%}
{{ ubuntu_block('wheezy', 9.1) }}