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

Revert "postgresql versions moved to common facts" #613

Merged
merged 1 commit into from
Sep 2, 2022
Merged
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
2 changes: 1 addition & 1 deletion ansible/data_quality_filter_service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- common
- java
- {role: db-backup, db: postgres, db_name: "{{ dq_db_name }}", db_user: "{{ dq_db_user }}", db_password: "{{ dq_db_password }}" }
- postgresql
- {role: postgresql, pg_version: "{{ data_quality_pg_version | default('13') }}"}
- {role: pg_instance, extensions: [], db_name: "{{ dq_db_name }}", db_user: "{{ dq_db_user }}", db_password: "{{ dq_db_password }}" }
- tomcat
- webserver
Expand Down
2 changes: 1 addition & 1 deletion ansible/doi-service-standalone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- java
- postfix
- {role: db-backup, db: postgres, db_name: "{{ doi_db_name }}", db_user: "{{ doi_db_user }}", db_password: "{{ doi_db_password }}" }
- postgresql
- {role: postgresql, pg_version: "9.6"}
- {role: pg_instance, extensions: ["citext", "pgcrypto"], db_name: "{{ doi_db_name }}", db_user: "{{ doi_db_user }}", db_password: "{{ doi_db_password }}" }
- {role: ansible-elasticsearch, es_templates: false, es_instance_name: 'doi-elasticsearch', es_data_dirs: ['/data/elasticsearch'], tags: ['elasticsearch']}
- webserver
Expand Down
4 changes: 1 addition & 3 deletions ansible/image-service.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
- hosts: image-service
vars:
use_postgis: true
roles:
# - java
- common
- { role: ansible-elasticsearch, es_templates: false, es_instance_name: 'images', tags: ['elasticsearch']}
- { role: db-backup, db: postgres, db_name: "images", db_user: "{{ image_service_db_username }}", db_password: "{{ image_service_db_password }}" }
- postgresql
- { role: postgresql, pg_version: "{{ image_service_postgresql_version | default('10') }}", postgis_version: "{{ image_service_postgis_version | default('2.4') }}" }
- { role: pg_instance, extensions: ["citext", "pgcrypto"], db_name: "{{ image_service_db_name }}", db_user: "{{ image_service_db_username }}", db_password: "{{ image_service_db_password }}", db_role_attr_flags: "NOSUPERUSER" }
- webserver
- i18n
Expand Down
2 changes: 0 additions & 2 deletions ansible/phylolink.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
- hosts: phylolink
vars:
use_postgis: true
roles:
- phylolink-dependencies
- common
Expand Down
9 changes: 0 additions & 9 deletions ansible/roles/common/tasks/setfacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,6 @@
python_software_properties: "python3-software-properties"
tomcat_dir: "/var/lib/{{ tomcat }}"
tomcat_webapps: "/var/lib/{{ tomcat }}/webapps/"
pg_version: '9.6'
postgis_version: '2.4'
postgis_scripts_version: '2.4'
# openjdk-8 will be removed at some point from Ubuntu-18.04, so we will need to switch to Zulu-8 or similar at that point
# openjdk-lts on Ubuntu-18.04 is JDK-11, so will not be directly useful by our applications at this point due to lack of testing
# use_openjdk8: true
Expand Down Expand Up @@ -127,9 +124,6 @@
python_software_properties: "python3-software-properties"
tomcat_dir: "/var/lib/{{ tomcat }}"
tomcat_webapps: "/var/lib/{{ tomcat }}/webapps/"
pg_version: '10'
postgis_version: '2.5'
postgis_scripts_version: '2.5'
# openjdk-8 will be removed at some point from Ubuntu-18.04, so we will need to switch to Zulu-8 or similar at that point
# use_openjdk8: true
# use_zulu8: False
Expand Down Expand Up @@ -167,9 +161,6 @@
tomcat_dir: "/var/lib/{{ tomcat }}"
tomcat_webapps: "/var/lib/{{ tomcat }}/webapps/"
psycopg2_package: "python3-psycopg2"
pg_version: '14'
postgis_version: '3'
postgis_scripts_version: '3.2'
when: ansible_os_family == "Debian" and ansible_distribution_version == "22.04"
tags:
- setfacts
Expand Down
1 change: 0 additions & 1 deletion ansible/roles/postgresql/defaults/main.yml

This file was deleted.

6 changes: 3 additions & 3 deletions ansible/roles/postgresql/tasks/debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
- name: Set postgis package names
set_fact:
postgresql_packages: "{{postgresql_packages}} + [ 'postgresql-{{pg_version}}-postgis-{{postgis_version}}', 'postgresql-{{pg_version}}-postgis-{{postgis_version}}-scripts', 'gdal-bin' ]"
when: postgis_version is defined and install_postgis | bool == True
when: postgis_version is defined
tags: postgresql

- name: Install Postgres
Expand Down Expand Up @@ -55,7 +55,7 @@
# Not pulling in recommended packages as that would pull in postgres-10
- name: Install separate postgis package to get shp2pgsql binary
apt: pkg="postgis" state="present" update_cache="yes" install_recommends="no"
when: postgis_version is defined and install_postgis | bool == True
when: postgis_version is defined
tags:
- postgresql
register: postgresql_installed
Expand All @@ -65,7 +65,7 @@
# PostGIS 2.2+ only needs CREATE EXTENSION postgis; CREATE EXTENSION postgis_topology; etc on the target DB
- debug:
msg: "PostGIS-enabled databases also need a corresponding pg_instance role with postgis in the extensions list"
when: postgis_version is defined and install_postgis | bool == True
when: postgis_version is defined

- name: start postgresql and configure to startup automatically
service:
Expand Down
21 changes: 7 additions & 14 deletions ansible/roles/postgresql/tasks/postgis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
- name: "Show postgis version"
debug:
msg: "postgis version: {{ postgis_version }} and installing postgis: {{ install_postgis }}"
tags:
- postgresql
- postgis

- name: install setfacl support
become: yes
apt:
pkg: acl
when: postgis_version and install_postgis | bool == True
when: postgis_version
tags:
- postgresql
- postgis
Expand All @@ -31,7 +24,7 @@
postgresql_db:
db: postgis_template
state: present
when: postgis_version and install_postgis | bool == True
when: postgis_version
become: yes
become_user: postgres
tags:
Expand All @@ -40,7 +33,7 @@

- name: make postgis_template a template
action: command psql -d postgis_template -c "UPDATE pg_database SET datistemplate=true WHERE datname='postgis_template';"
when: postgis_version and install_postgis | bool == True
when: postgis_version
become: yes
become_user: postgres
tags:
Expand All @@ -49,13 +42,13 @@

- name: run the postgis SQL scripts
action: command psql -d postgis_template -f {{ item }}
when: postgis_version and install_postgis | bool == True
when: postgis_version
become: yes
become_user: postgres
with_items:
- "/usr/share/postgresql/{{pg_version}}/contrib/postgis-{{postgis_scripts_version}}/postgis.sql"
- "/usr/share/postgresql/{{pg_version}}/contrib/postgis-{{postgis_scripts_version}}/spatial_ref_sys.sql"
- "/usr/share/postgresql/{{pg_version}}/contrib/postgis-{{postgis_scripts_version}}/postgis_comments.sql"
- "/usr/share/postgresql/{{pg_version}}/contrib/postgis-{{postgis_version}}/postgis.sql"
- "/usr/share/postgresql/{{pg_version}}/contrib/postgis-{{postgis_version}}/spatial_ref_sys.sql"
- "/usr/share/postgresql/{{pg_version}}/contrib/postgis-{{postgis_version}}/postgis_comments.sql"
tags:
- postgresql
- postgis
4 changes: 1 addition & 3 deletions ansible/spatial.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
- name: spatial
hosts: spatial
vars:
use_postgis: true
roles:
- common
- java
- tomcat
- webserver
- postgresql
- {role: postgresql, pg_service: 'postgresql-9.6', pg_version: '9.6', postgis_version: '2.4'}
- {role: pg_instance, extensions: ['postgis', 'postgis_topology', 'uuid-ossp'], db_name: "{{geonetwork_database}}", db_user: "{{geonetwork_db_username}}", db_password: "{{geonetwork_db_password }}" }
- {role: pg_instance, extensions: ['postgis', 'postgis_topology', 'uuid-ossp'], db_name: "{{layers_db_name}}", db_user: "{{layers_db_username}}", db_password: "{{layers_db_password}}" }
- layers-db
Expand Down