Skip to content

Commit

Permalink
Convert from using "psql" to using the Ansible module "postgresql_ext…
Browse files Browse the repository at this point in the history
…", which I suspect

is a more reliable method.
  • Loading branch information
Greg Clough authored and sebalix committed Mar 19, 2018
1 parent 7346fdb commit e918dbe
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tasks/databases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@
when: postgresql_databases|length > 0

- name: PostgreSQL | Add extensions to the databases
shell: "psql {{item.0.db}} --username {{postgresql_admin_user}} -c 'CREATE EXTENSION IF NOT EXISTS {{ item.1 }};'"
become: yes
become_user: "{{postgresql_service_user}}"
postgresql_ext:
db: "{{ item.0.db }}"
login_user: "{{ postgresql_service_user }}"
port: "{{ postgresql_port }}"
name: "{{ item.1 }}"
with_subelements:
- "{{postgresql_database_extensions}}"
- "{{ postgresql_database_extensions }}"
- extensions
register: result
changed_when: "'NOTICE' not in result.stderr"

- name: PostgreSQL | Add hstore to the databases with the requirement
become: yes
Expand Down

0 comments on commit e918dbe

Please sign in to comment.