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: diff --git a/postgres/client.sls b/postgres/client.sls new file mode 100644 index 0000000..d171f9a --- /dev/null +++ b/postgres/client.sls @@ -0,0 +1,17 @@ +{% from "postgres/map.jinja" import postgres with context %} + +{% if salt['pillar.get']('postgres:use_upstream_repo') %} +include: + - postgres.upstream +{% 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/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/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', 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 %}