# MongoDB (/library/dbdata/mongodb) greatly enhances the Sugarizer experience.
# The roles/mongodb playbook (was?) invoked by roles/sugarizer/meta/main.yml

# 2020-01-23: mongodb_install is completely ignored as MongoDB is installed on
# demand as a dependency -- by Sugarizer -- but for now we set fake value
# 'mongodb_install: True' for 'mongodb_installed is defined' tests e.g. in
# 0-init/tasks/validate_vars.yml

# mongodb_install: True

# FYI 'mongodb_enabled: False' works when Sugarizer is disabled.  Required by
# mongodb/tasks/enable.yml to shut down the service and log status, but that is
# misleading as Sugarizer starts mongodb's systemd service on its own, due to
# 'Requires=mongodb.service' within /etc/systemd/system/sugarizer.service

# mongodb_enabled: False

# mongodb_port: 27017

# All above are set in: github.com/iiab/iiab/blob/master/vars/default_vars.yml
# If nec, change them by editing /etc/iiab/local_vars.yml prior to installing!

mongodb_arch_dict:
  armv6l: unsupported    # WAS: 3.0
  armv7l: unsupported    # WAS: 3.0
  aarch64: 5.0
  i386: unsupported
  x86_64: 6.0

mongodb_version: "{{ mongodb_arch_dict[ansible_machine] | default('unknown') }}"    # A bit safer than ansible_architecture (see kiwix/defaults/main.yml)

#mongodb_arm64_version: 5.0    # 2023-02-24: MongoDB 6.0.4 fails to install on
#                              # 64-bit RasPiOS 11, as it doesn't offer libssl3.
#mongodb_amd64_version: 6.0    # 2022-10-23: 4.4 fails on Debian 12 x86_64:
# "No package matching 'mongodb-org' is available".  5.0+ fail on "pre-2011"
# CPU's w/o AVX, and on RPi due to MongoDB compiling these for v8.2-A (RPi 4 is
# ARM v8-A).  SO IIAB ALWAYS OVERLAYS andyfelong.com's 5.0.5 IF 5.0+ SPECIFIED.
#
# VERIFY both X.Y versions exist (+ work!) below:
#
# 1) https://www.mongodb.org/static/pgp/server-X.Y.asc ~= https://pgp.mongodb.com
# 2) http://repo.mongodb.org/apt/debian &/OR https://repo.mongodb.org/apt/ubuntu

mongodb_conf: /etc/mongod.conf
mongodb_db_path: "{{ content_base }}/dbdata/mongodb"    # /library/dbdata/mongodb
mongodb_db_lock_file: "{{ mongodb_db_path }}/mongod.lock"
