# msg: '9-STANZA BLOCK BELOW, RUNS *IF* 32-BIT -- i.e. not (ansible_architecture == "aarch64" or ansible_architecture == "x86_64") -- WILL LIKELY BE REMOVED SOON IN 2023, as MongoDB 3.0.1 is insufficient for Sugarizer Server 1.5.0''s new MongoDB 3.2+ REQUIREMENT: https://github.com/iiab/iiab/pull/3478#issuecomment-1444395170'
# - block:
# - name: Create dir /tmp/mongodb-3.0.1x (aarch32)
# when: not (ansible_architecture == "x86_64" or ansible_architecture == "aarch64") # ansible_machine is a bit safer than ansible_architecture (see kiwix/defaults/main.yml)
# - debug:
# msg: 9-STANZA BLOCK ABOVE, RAN *IF* 32-BIT -- i.e. not (ansible_architecture == "aarch64" or ansible_architecture == "x86_64")
#repo: deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/{{ mongodb_version }} multiverse
#filename: mongodb-org
when:not ansible_architecture == "x86_64"
#when: is_ubuntu or is_debian and os_ver is version('debian-12', '>=')
#when: is_ubuntu and os_ver is version('ubuntu-2204', '>=') or is_linuxmint and os_ver is version('linuxmint-12', '>=') or is_debian and os_ver is version('debian-12', '>=')
#when: not (is_debian and ansible_architecture == "x86_64")
# 2022-10-23: Force-install MongoDB on Ubuntu 22.04+, Mint 21 & Debian 12;
# as each includes libssl3 not libssl1.1 (#3190). LATER REMOVE ALL 7 STANZAS
# BELOW, IF/WHEN MongoDB ONE DAY FINALLY SUPPORTS libssl3 ? (MongoDB 6.2 fix
# may be backported to 6.0, according to 2022-09-29 "official" gossip here...)
msg:5-STANZA BLOCK FOLLOWS, TO FORCE INSTALL libssl1.1 -- runs *IF* mandated mongodb_version ({{ mongodb_version }}) < 6.0 (i.e. for aarch64/arm64) on Ubuntu 22.04+ or Debian 12+ -- whereas Linux Mint should never need libssl1.1
- name:Install OLD source/repo "deb http://ports.ubuntu.com/ubuntu-ports focal-security main" at /etc/apt/sources.list.d/ports_ubuntu_com_ubuntu_ports.list if Ubuntu
- name:Install OLD source/repo "deb http://security.debian.org/debian-security bullseye-security main" at /etc/apt/sources.list.d/security_debian_org_debian_security.list if Debian
- name:Remove OLD source/repo "deb http://security.debian.org/debian-security bullseye-security main" at /etc/apt/sources.list.d/security_debian_org_debian_security.list if Debian
apt_repository:
repo:deb http://security.debian.org/debian-security bullseye-security main
#repo: deb https://deb.debian.org/debian-security bullseye-security main # New way, likely equivalent
state:absent
when:is_debian
- name:Remove OLD source/repo "deb http://ports.ubuntu.com/ubuntu-ports focal-security main" at /etc/apt/sources.list.d/ports_ubuntu_com_ubuntu_ports.list if Ubuntu
apt_repository:
repo:deb http://ports.ubuntu.com/ubuntu-ports focal-security main
state:absent
when:is_ubuntu
when:mongodb_version is version('6.0', '<') and (is_ubuntu and os_ver is version('ubuntu-2204', '>=') or is_debian and os_ver is version('debian-12', '>='))
msg:5-STANZA BLOCK ABOVE, RAN *IF* FORCED INSTALL OF libssl1.1 WAS NEEDED
# - name: Install source/repo "deb http://security.ubuntu.com/ubuntu focal-security main" at /etc/apt/sources.list.d/security_ubuntu_com_ubuntu.list if Ubuntu 22.04+ x86_64 or Mint 21
# apt_repository:
# repo: deb http://security.ubuntu.com/ubuntu focal-security main
# #filename: focal-security # If filename focal-security.list is preferred
# when: is_ubuntu and os_ver is version('ubuntu-2204', '>=') and ansible_architecture == "x86_64" or is_linuxmint_21
# - name: Install source/repo "deb http://ports.ubuntu.com/ubuntu-ports focal-security main" at /etc/apt/sources.list.d/ports_ubuntu_com_ubuntu_ports.list if ubuntu 22.04+ aarch64
# apt_repository:
# repo: deb http://ports.ubuntu.com/ubuntu-ports focal-security main
# when: is_ubuntu and os_ver is version('ubuntu-2204', '>=') and ansible_architecture == "aarch64"
# - name: Install source/repo "deb http://security.debian.org/debian-security bullseye-security main" at /etc/apt/sources.list.d/security_debian_org_debian_security.list if Debian 12
# apt_repository:
# repo: deb http://security.debian.org/debian-security bullseye-security main
# #repo: deb https://deb.debian.org/debian-security bullseye-security main # New way, likely equivalent
# when: is_debian_12
# - name: Install libssl1.1 if Ubuntu 22.04+ or Mint 21 or Debian 12 (required by MongoDB below)
# package:
# name: libssl1.1
# state: present
# when: is_ubuntu and os_ver is version('ubuntu-2204', '>=') or is_linuxmint_21 or is_debian_12
# - name: Remove source/repo "deb http://security.debian.org/debian-security bullseye-security main" at /etc/apt/sources.list.d/security_debian_org_debian_security.list if Debian 12
# apt_repository:
# repo: deb http://security.debian.org/debian-security bullseye-security main
# #repo: deb https://deb.debian.org/debian-security bullseye-security main # New way, likely equivalent
# state: absent
# when: is_debian_12
# - name: Remove source/repo "deb http://ports.ubuntu.com/ubuntu-ports focal-security main" at /etc/apt/sources.list.d/ports_ubuntu_com_ubuntu_ports.list if ubuntu 22.04+ aarch64
# apt_repository:
# repo: deb http://ports.ubuntu.com/ubuntu-ports focal-security main
# state: absent
# when: is_ubuntu and os_ver is version('ubuntu-2204', '>=') and ansible_architecture == "aarch64"
# - name: Remove source/repo "deb http://security.ubuntu.com/ubuntu focal-security main" at /etc/apt/sources.list.d/security_ubuntu_com_ubuntu.list if Ubuntu 22.04+ x86_64 or Mint 21
# apt_repository:
# repo: deb http://security.ubuntu.com/ubuntu focal-security main
# state: absent
# #filename: focal-security # 100% IGNORED during repo deletion
# when: is_ubuntu and os_ver is version('ubuntu-2204', '>=') and ansible_architecture == "x86_64" or is_linuxmint_21
# # Debian 10 aarch64 might work below but is blocked in main.yml
# - name: Use mongodb-org's Ubuntu focal repo for RasPiOS-aarch64
# apt_repository:
# repo: deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse
# filename: mongodb-org
# when: is_raspbian and ansible_architecture == "aarch64"
# - name: Use mongodb-org's Ubuntu focal repo for Linux Mint - 64bit only
# apt_repository:
# repo: deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse
# filename: mongodb-org
# when: is_linuxmint
# - name: Use mongodb-org's Ubuntu repo for all non-Mint Ubuntu - 64bit only
# apt_repository:
# # 2020-10-27: https://repo.mongodb.org/apt/ubuntu/dists/ supports only
- name:Establish {{ mongodb_conf }} dbPath {{ mongodb_db_path }} -- instead of /var/lib/mongodb default -- takes effect on next (re)start of mongodb.service -- via enable-or-disable.yml or via sugarizer.service auto-starting MongoDB on demand
lineinfile:
path:"{{ mongodb_conf }}"# /etc/mongod.conf
regexp:'^\s*dbPath:'# \s = any whitespace char. stackoverflow.com/a/38491899
- name:Establish {{ mongodb_conf }} port {{ mongodb_port }} -- takes effect on next (re)start of mongodb.service -- via enable-or-disable.yml or via sugarizer.service auto-starting MongoDB on demand
lineinfile:
path:"{{ mongodb_conf }}"
regexp:'^\s*port:'
line:" port: {{ mongodb_port }}"# 27017
# 2022-06-07 #3236 MongoDB 5.0.9 "Illegal instruction" on RPi 4...
- name:If hardware is Raspberry Pi and mongodb_version >= 5.0, run 'apt-mark hold mongodb-org mongodb-org-server' -- so MongoDB 5.0.5 binaries {mongo, mongod, mongos} can be installed without apt interfering in future
command:apt-mark hold mongodb-org mongodb-org-server
when:rpi_model != "none" and mongodb_version is version('5.0', '>=')
- name:If hardware is Raspberry Pi and mongodb_version >= 5.0, unarchive 76MB {{ iiab_download_url }}//packages/raspbian_mongodb_5.0.5.gz OVERWRITING 5.0.9+ {mongo, mongod, mongos} in /usr/bin
when:rpi_model != "none" and mongodb_version is version('5.0', '>=')
# # end block
# when: ansible_architecture == "aarch64" or ansible_architecture == "x86_64"
# - debug:
# msg: 16-STANZA BLOCK ABOVE, RAN *IF* 64-BIT -- i.e. ansible_architecture == "aarch64" or ansible_architecture == "x86_64" # ansible_machine is a bit safer than ansible_architecture (see kiwix/defaults/main.yml)