mirror of
https://github.com/iiab/iiab.git
synced 2025-02-15 04:32:11 +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...
|
# 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)
|
# mongodb_stretch_3_0_14_tools.zip IS REALLY 3.0.15 (tools)
|
||||||
|
|
||||||
- debug:
|
# - 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'
|
# 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:
|
# - block:
|
||||||
- name: Create dir /tmp/mongodb-3.0.1x (aarch32)
|
# - name: Create dir /tmp/mongodb-3.0.1x (aarch32)
|
||||||
file:
|
# file:
|
||||||
path: /tmp/mongodb-3.0.1x
|
# path: /tmp/mongodb-3.0.1x
|
||||||
state: directory
|
# 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)
|
# - name: Download & unzip 20MB https://download.iiab.io/packages/mongodb_stretch_3_0_14_core.zip to /tmp/mongodb-3.0.1x (aarch32)
|
||||||
unarchive:
|
# unarchive:
|
||||||
remote_src: yes
|
# remote_src: yes
|
||||||
src: "{{ iiab_download_url }}/mongodb_stretch_3_0_14_core.zip" # https://download.iiab.io/packages
|
# src: "{{ iiab_download_url }}/mongodb_stretch_3_0_14_core.zip" # https://download.iiab.io/packages
|
||||||
dest: /tmp/mongodb-3.0.1x
|
# dest: /tmp/mongodb-3.0.1x
|
||||||
|
|
||||||
- name: Install (move) its 3 CORE binaries from /tmp/mongodb-3.0.1x/core to /usr/bin (aarch32)
|
# - 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
|
# 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)
|
# - 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:
|
# unarchive:
|
||||||
remote_src: yes
|
# remote_src: yes
|
||||||
src: "{{ iiab_download_url }}/mongodb_stretch_3_0_14_tools.zip"
|
# src: "{{ iiab_download_url }}/mongodb_stretch_3_0_14_tools.zip"
|
||||||
dest: /tmp/mongodb-3.0.1x
|
# 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)
|
# - 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
|
# shell: mv /tmp/mongodb-3.0.1x/tools/* /usr/bin
|
||||||
|
|
||||||
- name: Create Linux group mongodb (aarch32)
|
# - name: Create Linux group mongodb (aarch32)
|
||||||
group:
|
# group:
|
||||||
name: mongodb
|
# name: mongodb
|
||||||
state: present
|
# state: present
|
||||||
|
|
||||||
- name: Create Linux user mongodb (aarch32)
|
# - name: Create Linux user mongodb (aarch32)
|
||||||
user:
|
# user:
|
||||||
name: mongodb
|
# name: mongodb
|
||||||
group: mongodb # primary group
|
# group: mongodb # primary group
|
||||||
groups: mongodb
|
# groups: mongodb
|
||||||
home: /var/lib/mongodb
|
# home: /var/lib/mongodb
|
||||||
shell: /usr/sbin/nologin
|
# shell: /usr/sbin/nologin
|
||||||
|
|
||||||
- name: Install {{ mongodb_conf }} from template (aarch32)
|
# - name: Install {{ mongodb_conf }} from template (aarch32)
|
||||||
template:
|
# template:
|
||||||
src: mongod.conf.j2
|
# src: mongod.conf.j2
|
||||||
dest: "{{ mongodb_conf }}" # /etc/mongod.conf
|
# dest: "{{ mongodb_conf }}" # /etc/mongod.conf
|
||||||
|
|
||||||
- name: 'Create 2 dirs: /var/lib/mongodb, /var/log/mongodb (mongodb:mongodb)'
|
# - name: 'Create 2 dirs: /var/lib/mongodb, /var/log/mongodb (mongodb:mongodb)'
|
||||||
file:
|
# file:
|
||||||
state: directory
|
# state: directory
|
||||||
path: "{{ item }}"
|
# path: "{{ item }}"
|
||||||
owner: mongodb
|
# owner: mongodb
|
||||||
group: mongodb
|
# group: mongodb
|
||||||
with_items:
|
# with_items:
|
||||||
- /var/lib/mongodb
|
# - /var/lib/mongodb
|
||||||
- /var/log/mongodb
|
# - /var/log/mongodb
|
||||||
|
|
||||||
# end block
|
# # 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)
|
# 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:
|
# - debug:
|
||||||
msg: 9-STANZA BLOCK ABOVE, RAN *IF* 32-BIT -- i.e. not (ansible_architecture == "aarch64" or ansible_architecture == "x86_64")
|
# 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
|
# 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
|
# 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.
|
# installers for a while now.) 64-bit OS's proceed below.
|
||||||
|
|
||||||
|
|
||||||
- debug:
|
# - debug:
|
||||||
msg: 16-STANZA BLOCK BELOW, RUNS *IF* 64-BIT -- i.e. ansible_architecture == "aarch64" or ansible_architecture == "x86_64"
|
# 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 }}
|
- 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
|
# 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
|
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
|
state: absent
|
||||||
when: is_ubuntu
|
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:
|
- debug:
|
||||||
msg: 5-STANZA BLOCK ABOVE, RAN *IF* FORCED INSTALL OF libssl1.1 WAS NEEDED
|
msg: 5-STANZA BLOCK ABOVE, RAN *IF* FORCED INSTALL OF libssl1.1 WAS NEEDED
|
||||||
|
@ -321,11 +321,11 @@
|
||||||
dest: /usr/bin
|
dest: /usr/bin
|
||||||
when: rpi_model != "none" and mongodb_version is version('5.0', '>=')
|
when: rpi_model != "none" and mongodb_version is version('5.0', '>=')
|
||||||
|
|
||||||
# end block
|
# # end block
|
||||||
when: ansible_architecture == "aarch64" or ansible_architecture == "x86_64"
|
# when: ansible_architecture == "aarch64" or ansible_architecture == "x86_64"
|
||||||
|
|
||||||
- debug:
|
# - 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)
|
# 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
|
# 2. CONFIGURE MongoDB FOR IIAB
|
||||||
|
|
|
@ -34,19 +34,22 @@
|
||||||
var: is_debian
|
var: is_debian
|
||||||
- debug:
|
- debug:
|
||||||
var: is_raspbian
|
var: is_raspbian
|
||||||
- debug:
|
|
||||||
var: dpkg_arch
|
|
||||||
- debug:
|
- debug:
|
||||||
var: mongodb_version
|
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:
|
- 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!
|
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!)
|
msg: MongoDB 3.2+ (as needed by Sugarizer Server 1.5.0) is NO LONGER SUPPORTED on 32-bit Raspberry Pi OS.
|
||||||
when: (mongodb_version == "unsupported") or (dpkg_arch == "armhf")
|
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
|
- name: Install MongoDB if 'mongodb_installed' not defined, e.g. in {{ iiab_state_file }} # /etc/iiab/iiab_state.yml
|
||||||
include_tasks: install.yml
|
include_tasks: install.yml
|
||||||
when: mongodb_installed is undefined
|
when: mongodb_installed is undefined
|
||||||
|
|
10
test.yml
10
test.yml
|
@ -91,5 +91,15 @@
|
||||||
- debug:
|
- debug:
|
||||||
var: ansible_machine
|
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!
|
# TEST ANSIBLE COMMANDS/MODULES HERE!
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue