Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignore psqlrc #585

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tasks/check_pg_version_mismatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Check binary version
- name: PostgreSQL | Check binary version
shell: >
psql --version | sed 's/^psql (//' | sed 's/)//' | awk '{print $1, $2}'
psql -X --version | sed 's/^psql (//' | sed 's/)//' | awk '{print $1, $2}'
become: yes
become_user: "{{ postgresql_service_user }}"
changed_when: false
Expand All @@ -14,7 +14,7 @@
# Check database version
- name: PostgreSQL | Check database version
shell: >
psql --quiet --tuples-only --port={{ postgresql_port | int }} --command="select substring(version(),'[^\s]+\s+[^\s]+');" | sed 's/^ //'
psql -X --quiet --tuples-only --port={{ postgresql_port | int }} --command="select substring(version(),'[^\s]+\s+[^\s]+');" | sed 's/^ //'
become: yes
become_user: "{{ postgresql_service_user }}"
changed_when: false
Expand Down
14 changes: 7 additions & 7 deletions tasks/databases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
- name: PostgreSQL | Add hstore to the databases with the requirement
become: yes
become_user: "{{postgresql_service_user}}"
shell: "{{ postgresql_bin_directory}}/psql {{item.name}} --port={{ postgresql_port | int }} --username {{postgresql_admin_user}} -c 'CREATE EXTENSION IF NOT EXISTS hstore;'"
shell: "{{ postgresql_bin_directory}}/psql -X {{item.name}} --port={{ postgresql_port | int }} --username {{postgresql_admin_user}} -c 'CREATE EXTENSION IF NOT EXISTS hstore;'"
with_items: "{{postgresql_databases}}"
register: hstore_ext_result
failed_when: hstore_ext_result.rc != 0 and ("already exists, skipping" not in hstore_ext_result.stderr)
Expand All @@ -47,7 +47,7 @@
- name: PostgreSQL | Add uuid-ossp to the database with the requirement
become: yes
become_user: "{{postgresql_service_user}}"
shell: "{{ postgresql_bin_directory}}/psql {{item.name}} --port={{ postgresql_port | int }} --username {{postgresql_admin_user}} -c 'CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";'"
shell: "{{ postgresql_bin_directory}}/psql -X {{item.name}} --port={{ postgresql_port | int }} --username {{postgresql_admin_user}} -c 'CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";'"
with_items: "{{postgresql_databases}}"
register: uuid_ext_result
failed_when: uuid_ext_result.rc != 0 and ("already exists, skipping" not in uuid_ext_result.stderr)
Expand All @@ -57,35 +57,35 @@
- name: PostgreSQL | Add postgis to the databases with the requirement
become: yes
become_user: "{{postgresql_service_user}}"
shell: "{{ postgresql_bin_directory}}/psql {{item.name}} --port={{ postgresql_port | int }} --username {{postgresql_admin_user}} -c 'CREATE EXTENSION IF NOT EXISTS postgis;'&&psql {{item.name}} -c 'CREATE EXTENSION IF NOT EXISTS postgis_topology;'"
shell: "{{ postgresql_bin_directory}}/psql -X {{item.name}} --port={{ postgresql_port | int }} --username {{postgresql_admin_user}} -c 'CREATE EXTENSION IF NOT EXISTS postgis;'&&psql -X {{item.name}} -c 'CREATE EXTENSION IF NOT EXISTS postgis_topology;'"
with_items: "{{postgresql_databases}}"
when: item.gis is defined and item.gis

- name: PostgreSQL | add cube to the database with the requirement
become: yes
become_user: "{{postgresql_service_user}}"
shell: "{{ postgresql_bin_directory}}/psql {{item.name}} --port={{ postgresql_port | int }} --username {{ postgresql_admin_user }} -c 'create extension if not exists cube;'"
shell: "{{ postgresql_bin_directory}}/psql -X {{item.name}} --port={{ postgresql_port | int }} --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
become: yes
become_user: "{{postgresql_service_user}}"
shell: "{{ postgresql_bin_directory}}/psql {{item.name}} --port={{ postgresql_port | int }} --username {{ postgresql_admin_user }} -c 'CREATE EXTENSION IF NOT EXISTS plpgsql;'"
shell: "{{ postgresql_bin_directory}}/psql -X {{item.name}} --port={{ postgresql_port | int }} --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
become: yes
become_user: "{{postgresql_service_user}}"
shell: "{{ postgresql_bin_directory}}/psql {{item.name}} --port={{ postgresql_port | int }} --username {{ postgresql_admin_user }} -c 'create extension if not exists earthdistance;'"
shell: "{{ postgresql_bin_directory}}/psql -X {{item.name}} --port={{ postgresql_port | int }} --username {{ postgresql_admin_user }} -c 'create extension if not exists earthdistance;'"
with_items: "{{postgresql_databases}}"
when: item.earthdistance is defined and item.earthdistance

- name: PostgreSQL | Add citext to the database with the requirement
become: yes
become_user: "{{postgresql_service_user}}"
shell: "{{ postgresql_bin_directory}}/psql {{item.name}} --port={{ postgresql_port | int }} --username {{postgresql_admin_user}} -c 'CREATE EXTENSION IF NOT EXISTS citext;'"
shell: "{{ postgresql_bin_directory}}/psql -X {{item.name}} --port={{ postgresql_port | int }} --username {{postgresql_admin_user}} -c 'CREATE EXTENSION IF NOT EXISTS citext;'"
with_items: "{{postgresql_databases}}"
register: citext_ext_result
failed_when: citext_ext_result.rc != 0 and ("already exists, skipping" not in citext_ext_result.stderr)
Expand Down