From 1ed1159748c4a8849ce0db843e6915a871b9ec51 Mon Sep 17 00:00:00 2001 From: Forrest Alvarez Date: Sun, 26 Jan 2014 04:06:22 +0000 Subject: [PATCH] Updated postgres to add the map, and modified the init to support this. Updated readme as well. --- README.rst | 17 +++++++++++++++++ postgres/init.sls | 14 ++++++-------- postgres/map.jinja | 8 ++++++++ 3 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 postgres/map.jinja diff --git a/README.rst b/README.rst index 8c9b945..b193291 100644 --- a/README.rst +++ b/README.rst @@ -1,2 +1,19 @@ +======= postgres ======== + +.. note:: + + See the full `Salt Formulas installation and usage instructions + `_. + +Available states +================ + +.. contesnt:: + :local: + +``postgres`` +------------ + +Installs the postgresql package. diff --git a/postgres/init.sls b/postgres/init.sls index 727c4fc..d591ccc 100644 --- a/postgres/init.sls +++ b/postgres/init.sls @@ -1,9 +1,7 @@ -# pkg.install -postgresql: - pkg.installed: - {% if grains['os_family'] == 'RedHat' %} - - name: postgresql - {% elif grains['os_family'] == 'Debian' %} - - name: postgresql-9.1 - {% endif %} +{% from postgres/map.jinja import postgres with context %} + +postgresql: + pkg: + - installed + - name: {{ postgres.pkg }} diff --git a/postgres/map.jinja b/postgres/map.jinja new file mode 100644 index 0000000..03963cb --- /dev/null +++ b/postgres/map.jinja @@ -0,0 +1,8 @@ +{% set postgres = salt['grains.filter_by']({ + 'Debian': { + 'pkg': 'postgresql-9.1', + }, + 'RedHat': { + 'pkg': 'postgresql', + }, +}, merge=salt['pillar.get']('postgres:lookup')) %}