1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Install MongoDB binaries (3.0.14 core + 3.0.15 tools) onto RPi from andyfelong.com

This commit is contained in:
A Holt 2019-02-02 10:03:49 -05:00 committed by GitHub
parent 24088326a4
commit 7a7bbc77aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,13 +1,93 @@
- name: 'Install packages: mongodb, mongodb-server'
# 1. INSTALL MongoDB PACKAGES OR BINARIES
- name: 'Install packages: mongodb, mongodb-server (not rpi)'
package:
name:
- mongodb-server
- mongodb # 2019-01-31: this package does not exist on (cannot be installed on) Debian 10, SEE #1437
state: present
when: internet_available
when: internet_available and not is_rpi
tags:
- download
# 2019-02-02: Sugarizer with Node.js 10.x requires MongoDB 2.6+ so
# https://andyfelong.com/2017/08/mongodb-3-0-14-for-raspbian-stretch/
# is being used on RPi, all I found! (Raspbian's apt pkg is MongoDB 2.4.14)
#
# mongodb_stretch_3_0_14_core.zip (20M) & mongodb_stretch_3_0_14_tools.zip (15M)
# were backed up from andyfelong.com to http://download.iiab.io/packages/
#
# 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)
- name: Create dir /tmp/mongodb-3.0.1x (rpi)
file:
path: /tmp/mongodb-3.0.1x
state: directory
when: internet_available and is_rpi
- name: Download & unzip MongoDB 3.0.14's 3 CORE binaries to /tmp/mongodb-3.0.1x (rpi)
unarchive:
remote_src: yes
src: "{{ iiab_download_url }}/mongodb_stretch_3_0_14_core.zip"
dest: /tmp/mongodb-3.0.1x
when: internet_available and is_rpi
- name: Install (move) 3 binaries from /tmp/mongodb-3.0.1x/core to /usr/bin (rpi)
shell: mv /tmp/mongodb-3.0.1x/core/* /usr/bin
when: internet_available and is_rpi
- name: Download & unzip MongoDB 3.0.15's 9 TOOLS binaries to /tmp/mongodb-3.0.1x (rpi)
unarchive:
remote_src: yes
src: "{{ iiab_download_url }}/mongodb_stretch_3_0_14_tools.zip"
dest: /tmp/mongodb-3.0.1x
when: internet_available and is_rpi
- name: Install (move) 9 binaries from /opt/iiab/downloads/mongodb-3.0.1x/tools to /usr/bin (rpi)
shell: mv /tmp/mongodb-3.0.1x/tools/* /usr/bin
when: internet_available and is_rpi
# OLD WAY / MUCH SLOWER: had put unnec duplicate copies in /opt/iiab/downloads/mongodb-3.0.1x
#
#- name: Create dir /opt/iiab/downloads/mongodb-3.0.1x (rpi)
# file:
# path: "{{ downloads_dir }}/mongodb-3.0.1x"
# state: directory
# when: internet_available and is_rpi
#
#- name: Download & unzip MongoDB 3.0.14's 3 core binaries to /opt/iiab/downloads/mongodb-3.0.1x (rpi)
# unarchive:
# remote_src: yes
# src: "{{ iiab_download_url }}/mongodb_stretch_3_0_14_core.zip"
# dest: "{{ downloads_dir }}/mongodb-3.0.1x"
# when: internet_available and is_rpi
#
#- name: Install (copy) 3 binaries from /opt/iiab/downloads/mongodb-3.0.1x/core to /usr/bin (rpi)
# copy:
# src: "{{ item }}"
# dest: /usr/bin
# with_fileglob:
# - "{{ downloads_dir }}/mongodb-3.0.1x/core/*"
# when: internet_available and is_rpi
#
#- name: Download & unzip MongoDB 3.0.15's 9 tools binaries to /opt/iiab/downloads/mongodb-3.0.1x (rpi)
# unarchive:
# remote_src: yes
# src: "{{ iiab_download_url }}/mongodb_stretch_3_0_14_tools.zip"
# dest: "{{ downloads_dir }}/mongodb-3.0.1x"
# when: internet_available and is_rpi
#
#- name: Install (copy) 9 binaries from /opt/iiab/downloads/mongodb-3.0.1x/tools to /usr/bin (rpi)
# copy:
# src: "{{ item }}"
# dest: /usr/bin
# with_fileglob:
# - "{{ downloads_dir }}/mongodb-3.0.1x/tools/*"
# when: internet_available and is_rpi
# 2. CONFIGURE FOR IIAB
- name: 'Create 3 dirs for MongoDB: /var/run/mongodb, {{ mongodb_db_path }}, /var/log/mongodb'
file:
state: directory
@ -30,6 +110,8 @@
- { src: 'mongodb.service.j2', dest: '/etc/systemd/system/mongodb.service', mode: '0644' }
- { src: 'iiab-mongodb-repair-if-no-lock.j2', dest: '/usr/bin/iiab-mongodb-repair-if-no-lock', mode: '0755' }
# 3. ENABLE/DISABLE
- name: Enable & Restart 'mongodb' systemd service if mongodb_enabled, incl daemon-reload (in case mongodb.service changed?)
systemd:
name: mongodb
@ -45,6 +127,8 @@
state: stopped
when: not mongodb_enabled
# 4. DOCUMENT IN /etc/iiab/iiab.ini
- name: Add 'mongodb' variable values to {{ iiab_ini_file }}
ini_file:
path: "{{ iiab_ini_file }}"