From 0105a4d20916737d50c4b5df1cf3c2e52871a423 Mon Sep 17 00:00:00 2001 From: Pablo Astigarraga Date: Mon, 12 Jan 2015 17:58:44 -0200 Subject: [PATCH] Install extra postgres extensions --- tasks/databases.yml | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/tasks/databases.yml b/tasks/databases.yml index 4a10df36..eaaf3cad 100644 --- a/tasks/databases.yml +++ b/tasks/databases.yml @@ -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