From f6e68157a3e2e88c4d9e3734ab5c6e6c7d22abd4 Mon Sep 17 00:00:00 2001 From: Dominic Ferrantelli Date: Tue, 21 Apr 2015 13:06:41 -0700 Subject: [PATCH 1/3] added client formula and required default values --- postgres/client.sls | 24 ++++++++++++++++++++++++ postgres/map.jinja | 3 +++ 2 files changed, 27 insertions(+) create mode 100644 postgres/client.sls diff --git a/postgres/client.sls b/postgres/client.sls new file mode 100644 index 0000000..44986b1 --- /dev/null +++ b/postgres/client.sls @@ -0,0 +1,24 @@ +{% from "postgres/map.jinja" import postgres with context %} + +{% if salt['pillar.get']('postgres:use_upstream_repo') %} +install-postgresql-repo: + pkgrepo.managed: + - humanname: PostgreSQL Official Repository + - name: {{ postgres.pkg_repo }} + - keyid: B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8 + - keyserver: keyserver.ubuntu.com + - file: {{ postgres.pkg_repo_file }} + - require_in: + - install-postgresql-client +{% endif %} + +install-postgresql-client: + pkg.installed: + - name: {{ postgres.pkg_client }} + - refresh: {{ salt['pillar.get']('postgres:use_upstream_repo', False) }} + +{% if postgres.pkg_libpq_dev != False %} +install-postgres-libpq-dev: + pkg.installed: + - name: {{ postgres.pkg_libpq_dev }} +{% endif %} diff --git a/postgres/map.jinja b/postgres/map.jinja index f221cf7..543b4ab 100644 --- a/postgres/map.jinja +++ b/postgres/map.jinja @@ -15,6 +15,7 @@ 'pkg' : 'postgresql-server', 'pkg_dev' : 'postgresql-devel', 'pkg_libpq_dev' : 'postgresql-libs', + 'pkg_client' : 'postgresql-client', 'python' : 'python-psycopg2', 'service' : 'postgresql', 'conf_dir' : '/var/lib/pgsql/data', @@ -26,6 +27,7 @@ 'pkg' : 'postgresql', 'pkg_dev' : 'postgresql-devel', 'pkg_libpq_dev' : 'postgresql-libs', + 'pkg_client' : 'postgresql-client', 'python' : 'python-psycopg2', 'service' : 'postgresql', 'conf_dir' : '/var/lib/pgsql/data', @@ -37,6 +39,7 @@ 'pkg' : 'postgresql-' + pg_version.id, 'pkg_dev' : 'postgresql-server-dev-' + pg_version.id, 'pkg_libpq_dev' : 'libpq-dev', + 'pkg_client' : 'postgresql-client-'+ pg_version.id, 'pkg_contrib' : 'postgresql-contrib-' + pg_version.id, 'pkg_repo' : 'deb http://apt.postgresql.org/pub/repos/apt/ ' + grains['lsb_distrib_codename'] + '-pgdg main', 'pkg_repo_file' : '/etc/apt/sources.list.d/pgdg.list', From c62b41524db24ca3f2f2aeb0a9767ad769c58a43 Mon Sep 17 00:00:00 2001 From: Dominic Ferrantelli Date: Tue, 21 Apr 2015 13:40:01 -0700 Subject: [PATCH 2/3] updated README and pillar.example to include client formula --- README.rst | 5 +++++ pillar.example | 1 + 2 files changed, 6 insertions(+) diff --git a/README.rst b/README.rst index a3077ae..71ebb2d 100644 --- a/README.rst +++ b/README.rst @@ -23,6 +23,11 @@ Installs the postgresql package. Installs the postgresql python module +``postgres.client`` +------------------- + +Installs the postgresql client + Testing ======= diff --git a/pillar.example b/pillar.example index 15750ea..4aece09 100644 --- a/pillar.example +++ b/pillar.example @@ -5,6 +5,7 @@ postgres: lookup: pkg: 'postgresql-9.3' + pkg_client: 'postgresql-client-9.3' pg_hba: '/etc/postgresql/9.3/main/pg_hba.conf' users: From 7ddfbb22e6d28c2ce4978aeaed15c1e20de6a4f9 Mon Sep 17 00:00:00 2001 From: Dominic Ferrantelli Date: Tue, 21 Apr 2015 15:13:42 -0700 Subject: [PATCH 3/3] moved upstream repo to an include, checked for Ubuntu before attempting to add it --- postgres/client.sls | 11 ++--------- postgres/init.sls | 11 ++--------- postgres/upstream.sls | 11 +++++++++++ 3 files changed, 15 insertions(+), 18 deletions(-) create mode 100644 postgres/upstream.sls diff --git a/postgres/client.sls b/postgres/client.sls index 44986b1..d171f9a 100644 --- a/postgres/client.sls +++ b/postgres/client.sls @@ -1,15 +1,8 @@ {% from "postgres/map.jinja" import postgres with context %} {% if salt['pillar.get']('postgres:use_upstream_repo') %} -install-postgresql-repo: - pkgrepo.managed: - - humanname: PostgreSQL Official Repository - - name: {{ postgres.pkg_repo }} - - keyid: B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8 - - keyserver: keyserver.ubuntu.com - - file: {{ postgres.pkg_repo_file }} - - require_in: - - install-postgresql-client +include: + - postgres.upstream {% endif %} install-postgresql-client: diff --git a/postgres/init.sls b/postgres/init.sls index 1c3611e..f1a2009 100644 --- a/postgres/init.sls +++ b/postgres/init.sls @@ -1,15 +1,8 @@ {% from "postgres/map.jinja" import postgres with context %} {% if salt['pillar.get']('postgres:use_upstream_repo') %} -install-postgresql-repo: - pkgrepo.managed: - - humanname: PostgreSQL Official Repository - - name: {{ postgres.pkg_repo }} - - keyid: B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8 - - keyserver: keyserver.ubuntu.com - - file: {{ postgres.pkg_repo_file }} - - require_in: - - install-postgresql +include: + - postgres.upstream {% endif %} install-postgresql: diff --git a/postgres/upstream.sls b/postgres/upstream.sls new file mode 100644 index 0000000..d5da6da --- /dev/null +++ b/postgres/upstream.sls @@ -0,0 +1,11 @@ +{% from "postgres/map.jinja" import postgres with context %} + +{% if grains['os'] == 'Ubuntu' %} # Other distro support should be added here +install-postgresql-repo: + pkgrepo.managed: + - humanname: PostgreSQL Official Repository + - name: {{ postgres.pkg_repo }} + - keyid: B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8 + - keyserver: keyserver.ubuntu.com + - file: {{ postgres.pkg_repo_file }} +{% endif %}