Skip to content

Commit

Permalink
Install extra postgres extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablo Astigarraga committed Jan 13, 2015
1 parent 840e93e commit 0105a4d
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions tasks/databases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,26 @@
when: postgresql_databases|length > 0

- name: PostgreSQL | Add hstore to the databases with the requirement
sudo: yes
sudo_user: "{{postgresql_admin_user}}"
shell: "psql {{item.name}} -c 'CREATE EXTENSION IF NOT EXISTS hstore;'"
shell: "psql {{item.name}} --username {{postgresql_admin_user}} -c 'CREATE EXTENSION IF NOT EXISTS hstore;'"
with_items: postgresql_databases
when: item.hstore is defined and item.hstore

- name: PostgreSQL | Add uuid-ossp to the database with the requirement
sudo: yes
sudo_user: "{{postgresql_admin_user}}"
shell: "psql {{item.name}} -c 'CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";'"
shell: "psql {{item.name}} --username {{postgresql_admin_user}} -c 'CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";'"
with_items: postgresql_databases
when: item.uuid_ossp is defined and item.uuid_ossp

- name: postgresql | add cube to the database with the requirement
shell: "psql {{item.name}} --username {{ postgresql_admin_user }} -c 'create extension if not exists cube;'"
with_items: postgresql_databases
when: item.cube is defined and item.cube

- name: PostgreSQL | Add plpgsql to the database with the requirement
shell: "psql {{item.name}} --username {{ postgresql_admin_user }} -c 'CREATE EXTENSION IF NOT EXISTS plpgsql;'"
with_items: postgresql_databases
when: item.plpgsql is defined and item.plpgsql

- name: postgresql | add earthdistance to the database with the requirement
shell: "psql {{item.name}} --username {{ postgresql_admin_user }} -c 'create extension if not exists earthdistance;'"
with_items: postgresql_databases
when: item.earthdistance is defined and item.earthdistance

0 comments on commit 0105a4d

Please sign in to comment.