mirror of
https://github.com/iiab/iiab.git
synced 2025-02-14 20:22:08 +00:00
Block install of MongoDB on 32-bit RasPiOS
This commit is contained in:
parent
faa4145d65
commit
dcad86f6d1
3 changed files with 295 additions and 282 deletions
|
@ -16,66 +16,66 @@
|
|||
# CLARIF: mongodb_stretch_3_0_14_core.zip IS IN FACT 3.0.14 (core) BUT...
|
||||
# mongodb_stretch_3_0_14_tools.zip IS REALLY 3.0.15 (tools)
|
||||
|
||||
- debug:
|
||||
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'
|
||||
# - debug:
|
||||
# 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)
|
||||
file:
|
||||
path: /tmp/mongodb-3.0.1x
|
||||
state: directory
|
||||
# - block:
|
||||
# - name: Create dir /tmp/mongodb-3.0.1x (aarch32)
|
||||
# file:
|
||||
# path: /tmp/mongodb-3.0.1x
|
||||
# state: directory
|
||||
|
||||
- name: Download & unzip 20MB https://download.iiab.io/packages/mongodb_stretch_3_0_14_core.zip to /tmp/mongodb-3.0.1x (aarch32)
|
||||
unarchive:
|
||||
remote_src: yes
|
||||
src: "{{ iiab_download_url }}/mongodb_stretch_3_0_14_core.zip" # https://download.iiab.io/packages
|
||||
dest: /tmp/mongodb-3.0.1x
|
||||
# - name: Download & unzip 20MB https://download.iiab.io/packages/mongodb_stretch_3_0_14_core.zip to /tmp/mongodb-3.0.1x (aarch32)
|
||||
# unarchive:
|
||||
# remote_src: yes
|
||||
# src: "{{ iiab_download_url }}/mongodb_stretch_3_0_14_core.zip" # https://download.iiab.io/packages
|
||||
# dest: /tmp/mongodb-3.0.1x
|
||||
|
||||
- name: Install (move) its 3 CORE binaries from /tmp/mongodb-3.0.1x/core to /usr/bin (aarch32)
|
||||
shell: mv /tmp/mongodb-3.0.1x/core/* /usr/bin
|
||||
# - name: Install (move) its 3 CORE binaries from /tmp/mongodb-3.0.1x/core to /usr/bin (aarch32)
|
||||
# shell: mv /tmp/mongodb-3.0.1x/core/* /usr/bin
|
||||
|
||||
- name: Download & unzip 15MB https://download.iiab.io/packages/mongodb_stretch_3_0_14_tools.zip [IN FACT THIS ONE'S 3.0.15] to /tmp/mongodb-3.0.1x (aarch32)
|
||||
unarchive:
|
||||
remote_src: yes
|
||||
src: "{{ iiab_download_url }}/mongodb_stretch_3_0_14_tools.zip"
|
||||
dest: /tmp/mongodb-3.0.1x
|
||||
# - name: Download & unzip 15MB https://download.iiab.io/packages/mongodb_stretch_3_0_14_tools.zip [IN FACT THIS ONE'S 3.0.15] to /tmp/mongodb-3.0.1x (aarch32)
|
||||
# unarchive:
|
||||
# remote_src: yes
|
||||
# src: "{{ iiab_download_url }}/mongodb_stretch_3_0_14_tools.zip"
|
||||
# dest: /tmp/mongodb-3.0.1x
|
||||
|
||||
- name: Install (move) its 9 TOOLS binaries from /opt/iiab/downloads/mongodb-3.0.1x/tools to /usr/bin (aarch32)
|
||||
shell: mv /tmp/mongodb-3.0.1x/tools/* /usr/bin
|
||||
# - name: Install (move) its 9 TOOLS binaries from /opt/iiab/downloads/mongodb-3.0.1x/tools to /usr/bin (aarch32)
|
||||
# shell: mv /tmp/mongodb-3.0.1x/tools/* /usr/bin
|
||||
|
||||
- name: Create Linux group mongodb (aarch32)
|
||||
group:
|
||||
name: mongodb
|
||||
state: present
|
||||
# - name: Create Linux group mongodb (aarch32)
|
||||
# group:
|
||||
# name: mongodb
|
||||
# state: present
|
||||
|
||||
- name: Create Linux user mongodb (aarch32)
|
||||
user:
|
||||
name: mongodb
|
||||
group: mongodb # primary group
|
||||
groups: mongodb
|
||||
home: /var/lib/mongodb
|
||||
shell: /usr/sbin/nologin
|
||||
# - name: Create Linux user mongodb (aarch32)
|
||||
# user:
|
||||
# name: mongodb
|
||||
# group: mongodb # primary group
|
||||
# groups: mongodb
|
||||
# home: /var/lib/mongodb
|
||||
# shell: /usr/sbin/nologin
|
||||
|
||||
- name: Install {{ mongodb_conf }} from template (aarch32)
|
||||
template:
|
||||
src: mongod.conf.j2
|
||||
dest: "{{ mongodb_conf }}" # /etc/mongod.conf
|
||||
# - name: Install {{ mongodb_conf }} from template (aarch32)
|
||||
# template:
|
||||
# src: mongod.conf.j2
|
||||
# dest: "{{ mongodb_conf }}" # /etc/mongod.conf
|
||||
|
||||
- name: 'Create 2 dirs: /var/lib/mongodb, /var/log/mongodb (mongodb:mongodb)'
|
||||
file:
|
||||
state: directory
|
||||
path: "{{ item }}"
|
||||
owner: mongodb
|
||||
group: mongodb
|
||||
with_items:
|
||||
- /var/lib/mongodb
|
||||
- /var/log/mongodb
|
||||
# - name: 'Create 2 dirs: /var/lib/mongodb, /var/log/mongodb (mongodb:mongodb)'
|
||||
# file:
|
||||
# state: directory
|
||||
# path: "{{ item }}"
|
||||
# owner: mongodb
|
||||
# group: mongodb
|
||||
# with_items:
|
||||
# - /var/lib/mongodb
|
||||
# - /var/log/mongodb
|
||||
|
||||
# end block
|
||||
when: not (ansible_architecture == "x86_64" or ansible_architecture == "aarch64") # ansible_machine is a bit safer than ansible_architecture (see kiwix/defaults/main.yml)
|
||||
# # end block
|
||||
# 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")
|
||||
# - debug:
|
||||
# msg: 9-STANZA BLOCK ABOVE, RAN *IF* 32-BIT -- i.e. not (ansible_architecture == "aarch64" or ansible_architecture == "x86_64")
|
||||
|
||||
# 32-bit OS's [WERE] handled above: this should handle aarch32 including 32-bit
|
||||
# Ubuntu from https://ubuntu.com/download/raspberry-pi but Ubuntu 20.04+ and
|
||||
|
@ -84,10 +84,10 @@
|
|||
# installers for a while now.) 64-bit OS's proceed below.
|
||||
|
||||
|
||||
- debug:
|
||||
msg: 16-STANZA BLOCK BELOW, RUNS *IF* 64-BIT -- i.e. ansible_architecture == "aarch64" or ansible_architecture == "x86_64"
|
||||
# - debug:
|
||||
# msg: 16-STANZA BLOCK BELOW, RUNS *IF* 64-BIT -- i.e. ansible_architecture == "aarch64" or ansible_architecture == "x86_64"
|
||||
|
||||
- block:
|
||||
# - block:
|
||||
- name: Add mongodb.org signing key (only 64-bit available) for MongoDB version {{ mongodb_version }}
|
||||
# https://www.mongodb.com/community/forums/t/installing-mongodb-over-ubuntu-22-04/159931/90
|
||||
shell: wget -qO - https://www.mongodb.org/static/pgp/server-{{ mongodb_version }}.asc | gpg --dearmor > /usr/share/keyrings/mongodb.gpg
|
||||
|
@ -195,7 +195,7 @@
|
|||
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_12 and os_ver is version('debian-12', '>='))
|
||||
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', '>='))
|
||||
|
||||
- debug:
|
||||
msg: 5-STANZA BLOCK ABOVE, RAN *IF* FORCED INSTALL OF libssl1.1 WAS NEEDED
|
||||
|
@ -321,11 +321,11 @@
|
|||
dest: /usr/bin
|
||||
when: rpi_model != "none" and mongodb_version is version('5.0', '>=')
|
||||
|
||||
# end block
|
||||
when: ansible_architecture == "aarch64" or ansible_architecture == "x86_64"
|
||||
# # 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)
|
||||
# - 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)
|
||||
|
||||
|
||||
# 2. CONFIGURE MongoDB FOR IIAB
|
||||
|
|
|
@ -34,19 +34,22 @@
|
|||
var: is_debian
|
||||
- debug:
|
||||
var: is_raspbian
|
||||
- debug:
|
||||
var: dpkg_arch
|
||||
- debug:
|
||||
var: mongodb_version
|
||||
|
||||
- name: Run command 'dpkg --print-architecture' to identify OS architecture (CPU arch as revealed by ansible_archicture ~= ansible_machine is NOT enough!)
|
||||
command: dpkg --print-architecture
|
||||
register: dpkg_arch
|
||||
- debug:
|
||||
msg: "'dpkg --print-architecture' output: {{ dpkg_arch.stdout }}"
|
||||
|
||||
- block:
|
||||
|
||||
- name: EXIT 'mongodb' ROLE & CONTINUE, when 32bit RasPiOS is in use or 'unsupported'
|
||||
- name: EXIT 'mongodb' ROLE, if 'dpkg --print-architecture' shows "armhf" or mongodb_version == "unsupported" or ansible_machine not found
|
||||
fail: # FORCE IT RED THIS ONCE!
|
||||
msg: ATTEMPTED MongoDB INSTALLATION WITH 32bit RasPiOS, which is not supported upstream. Nevertheless IIAB will continue (consider this a warning!)
|
||||
when: (mongodb_version == "unsupported") or (dpkg_arch == "armhf")
|
||||
msg: MongoDB 3.2+ (as needed by Sugarizer Server 1.5.0) is NO LONGER SUPPORTED on 32-bit Raspberry Pi OS.
|
||||
when: dpkg_arch.stdout == "armhf" or mongodb_version == "unsupported" or mongodb_version == "unknown"
|
||||
|
||||
# ELSE...
|
||||
- name: Install MongoDB if 'mongodb_installed' not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml
|
||||
include_tasks: install.yml
|
||||
when: mongodb_installed is undefined
|
||||
|
|
10
test.yml
10
test.yml
|
@ -91,5 +91,15 @@
|
|||
- debug:
|
||||
var: ansible_machine
|
||||
|
||||
- command: dpkg --print-architecture
|
||||
register: cmd
|
||||
- debug:
|
||||
msg: "'dpkg --print-architecture' output: {{ cmd.stdout }}"
|
||||
|
||||
- command: dpkg --print-foreign-architectures
|
||||
register: cmd
|
||||
- debug:
|
||||
msg: "'dpkg --print-foreign-architectures' output: {{ cmd.stdout }}"
|
||||
|
||||
# TEST ANSIBLE COMMANDS/MODULES HERE!
|
||||
|
||||
|
|
Loading…
Reference in a new issue