Error - installing with PostgreSQL back end
tricksol opened this issue · 1 comments
When attempting to use the ansible installer to setup PostgreSQL back end you receive an error.
The role variables tells you to use PostgreSQL in production (https://github.com/openwisp/ansible-openwisp2#usage-tutorial)
Specifically this section.
edit database settings only if you are not using sqlite
# eg, for deploying with PostgreSQL (recommended for production usage)
# you will need the PostGIS spatial extension, find more info at:
# https://docs.djangoproject.com/en/4.1/ref/contrib/gis/tutorial/
openwisp2_database:
engine: django.contrib.gis.db.backends.postgis
name: "{{ DB_NAME }}"
user: "{{ DB_USER }}"
host: "{{ DB_HOST }}"
password: "{{ DB_PASSWORD }}"
port: 5432
I have a working PostGIS server ready to take the database but when running the ansbile playbook I receive this error.
TASK [openwisp.openwisp2 : Set spatialite_path (Ubuntu >= 18.04 or Debian >= 10)] ****************************************************************************************
fatal: [hal2.nationalwi-fi.com]: FAILED! => {"msg": "The conditional check 'openwisp2_database.engine == "django.contrib.gis.db.backends.spatialite" and openwisp2_spatialite_path is none\n' failed. The error was: error while evaluating conditional (openwisp2_database.engine == "django.contrib.gis.db.backends.spatialite" and openwisp2_spatialite_path is none\n): {'engine': 'django.contrib.gis.db.backends.postgis', 'name': '{{openwsip2_databasename}', 'user': '{{username}}', 'host': '{{hostIP}}', 'password': '{{Password}}', 'port': 5432}: 'openwsip2_database' is undefined\n\nThe error appears to be in '/home/mmidgett/.ansible/roles/openwisp.openwisp2/tasks/variables-spatialite.yml': line 3, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Set spatialite_path
(Ubuntu >= 18.04 or Debian >= 10)\n ^ here\n"}
The error suggests this file variables-spatialite.yml
- name: Set spatialite_path (Ubuntu >= 18.04 or Debian >= 10)
set_fact:
openwisp2_spatialite_path: "mod_spatialite.so"
when: >
(ansible_distribution == 'Ubuntu'
and ansible_distribution_version is version_compare('18.04', 'ge'))
or (ansible_distribution == 'Debian' and
ansible_distribution_version is version_compare('10', 'ge'))
SPATIALITE_LIBRARY_PATH django setting
The role will attempt determining the right mod-spatialite path automatically
But you can use this variable to customize the path or fix future arising issues
openwisp2_spatialite_path: null
@tricksol I cannot replicate this, we manage quite a few instances running postrgres and we are not incurring into this issue.