Permalink
Browse files

Refactored postgres.

Created a ppa.sls file to setup the postgres ppa and added a client sls
to install the pg client.
  • Loading branch information...
rca committed Mar 12, 2013
1 parent ace4957 commit 34f5e19216453038a89a58620e4d5aa8cbf49e24
Showing with 47 additions and 24 deletions.
  1. +12 −0 client.sls
  2. +3 −24 init.sls
  3. +32 −0 ppa.sls
View
@@ -0,0 +1,12 @@
+include:
+ - postgresql.ppa
+
+{% set pg_list = '/etc/apt/sources.list.d/postgresql.list' %}
+{% set pg_pref = '/etc/apt/preferences.d/pgdg.pref' %}
+
+
+postgresql-client-9.2:
+ pkg.installed:
+ - require:
+ - file: {{ pg_list }}
+ - file: {{ pg_pref }}
View
@@ -1,31 +1,10 @@
-{% set pg_key_url = 'http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc' %}
+include:
+ - postgresql.ppa
+
{% set pg_list = '/etc/apt/sources.list.d/postgresql.list' %}
{% set pg_pref = '/etc/apt/preferences.d/pgdg.pref' %}
-add_postgresql_apt_key:
- cmd.run:
- - name: wget -O - {{ pg_key_url }} | apt-key add -
- - unless: sudo apt-key list | grep -q 'PostgreSQL Debian Repository'
-
-
-{% for file in [pg_list, pg_pref] %}
-{{ file }}:
- file.managed:
- - source: salt://postgresql/files{{ file }}
- - user: root
- - group: root
- - mode: 0644
-{% endfor %}
-
-
-update_apt:
- cmd.wait:
- - name: apt-get update
- - watch:
- - file: {{ pg_list }}
-
-
postgresql:
service:
- running
View
32 ppa.sls
@@ -0,0 +1,32 @@
+include:
+ - baremetal.base
+
+{% set pg_key_url = 'http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc' %}
+{% set pg_list = '/etc/apt/sources.list.d/postgresql.list' %}
+{% set pg_pref = '/etc/apt/preferences.d/pgdg.pref' %}
+
+
+add_postgresql_apt_key:
+ cmd.run:
+ - name: wget -O - {{ pg_key_url }} | apt-key add -
+ - unless: sudo apt-key list | grep -q 'PostgreSQL Debian Repository'
+ - require:
+ - pkg.installed: baremetal_packages
+
+{% for file in [pg_list, pg_pref] %}
+{{ file }}:
+ file.managed:
+ - source: salt://postgresql/files{{ file }}
+ - user: root
+ - group: root
+ - mode: 0644
+ - require:
+ - cmd: add_postgresql_apt_key
+{% endfor %}
+
+
+update_apt:
+ cmd.wait:
+ - name: apt-get update
+ - watch:
+ - file: {{ pg_list }}

0 comments on commit 34f5e19

Please sign in to comment.