1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 11:42:08 +00:00

Merge pull request #203 from jvonau/nodejs

sync from jvonau:nodejs
This commit is contained in:
A Holt 2019-01-16 10:53:43 -05:00 committed by GitHub
commit 08735bbd3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 50 additions and 74 deletions

View file

@ -0,0 +1,45 @@
- name: Set up Node.js 8.x apt sources (debuntu distros up to 2017)
shell: curl -sL https://deb.nodesource.com/setup_8.x | bash -
args:
warn: no
when: internet_available and (is_debian_8 or is_debian_9 or is_ubuntu_16 or is_ubuntu_17)
# NOT NEC TO TEST FOR is_raspbian_8 OR is_raspbian_9 AS /opt/iiab/iiab/vars/<OS>.yml
# DEFINES THESE AS SUBSETS OF is_debian_8 OR is_debian_9 (FOR NOW!)
- name: Install latest Node.js which includes /usr/bin/npm (debuntu distros up to 2017)
package:
name: nodejs
# name: nodejs=8.x
state: latest
# state: present
when: internet_available and (is_debian_8 or is_debian_9 or is_ubuntu_16 or is_ubuntu_17)
# 2019-01-15: BORROWED BY https://github.com/iiab/iiab/blob/master/roles/nodered/tasks/main.yml#L1-L26
# 2018-07-14: BOTH STEPS ABOVE TAKE TIME, but Raspbian (apt offers npm
# 1.4.21) & Debian 9 (apt offers no npm!) STILL NEED the above
# nodesource.com approach to get a version of npm that works with Sugarizer:
# https://github.com/iiab/iiab/issues/798#issuecomment-404324530
#
# MORE POSITIVELY: this nodesource.com approach (brings in npm 5.6.0 with
# nodejs 8.11.3 for now, to any OS) would also work on Ubuntu 18.04, and
# might even bring about a sane consistency across mainline OS's?
#
# BUT FOR NOW: Ubuntu 18.04's apt (approach below) brings in npm 3.5.2,
# which appears suffic "SO FAR"? 18.04's nodejs 8.10.0 is more reassuring!
# CRAZY IDEA: most versions of npm can upgrade themselves to the latest
# (6.2.0 for now) using command "npm install -g npm", if that helps us in
# future, e.g. TK's memory issue etc? If so, be CAREFUL this puts npm
# in /usr/local/bin on Ubuntu 18.04 -- unlike Ubuntu 16.04 and Raspbian
# where it upgrades /usr/bin/npm in place:
# https://askubuntu.com/questions/1036278/npm-is-incorrect-version-on-latest-ubuntu-18-04-installation
- name: Install latest packages nodejs and npm (debuntu distros after 2017, or other distros)
package:
name:
- nodejs
- npm
state: latest
when: internet_available and not (is_debian_8 or is_debian_9 or is_ubuntu_16 or is_ubuntu_17)

View file

@ -0,0 +1,3 @@
dependencies:
- { role: nodejs, tags: ['nodejs'], when: nodered_install }

View file

@ -1,31 +1,3 @@
- name: Set up Node.js 8.x apt sources (debuntu distros up to 2017)
shell: curl -sL https://deb.nodesource.com/setup_8.x | bash -
args:
warn: no
when: internet_available and (is_debian_8 or is_debian_9 or is_ubuntu_16 or is_ubuntu_17) and nodered_install
# NOT NEC TO TEST FOR is_raspbian_8 OR is_raspbian_9 AS /opt/iiab/iiab/vars/<OS>.yml
# DEFINES THESE AS SUBSETS OF is_debian_8 OR is_debian_9 (FOR NOW!)
- name: Install latest Node.js which includes /usr/bin/npm (debuntu distros up to 2017)
package:
name: nodejs
# name: nodejs=8.x
state: latest
# state: present
when: internet_available and (is_debian_8 or is_debian_9 or is_ubuntu_16 or is_ubuntu_17) and nodered_install
# 2019-01-15: WE'RE BORROWING npm INSTALLATION TRICKS FROM MID-2018 SUGARIZER:
# https://github.com/iiab/iiab/blob/master/roles/sugarizer/tasks/main.yml#L77-L94
- name: Install latest packages nodejs and npm (debuntu distros after 2017, or other distros)
package:
name:
- nodejs
- npm
state: latest
when: internet_available and not (is_debian_8 or is_debian_9 or is_ubuntu_16 or is_ubuntu_17) and nodered_install
- name: 'npm install node-red packages globally: node-red, node-red-admin, node-red-dashboard'
shell: npm install -g --unsafe-perm node-red node-red-admin node-red-dashboard
when: nodered_install

View file

@ -1,2 +1,3 @@
dependencies:
- { role: mongodb, tags: ['generic','mongodb'], when: sugarizer_install }
- { role: nodejs, tags: ['nodejs'], when: sugarizer_install }

View file

@ -59,52 +59,7 @@
# 3. INSTALL A GOOD VERSION OF Node.js AND npm
- name: Set up Node.js 8.x apt sources (debuntu distros up to 2017)
shell: curl -sL https://deb.nodesource.com/setup_8.x | bash -
args:
warn: no
when: internet_available and (is_debian_8 or is_debian_9 or is_ubuntu_16 or is_ubuntu_17)
# NOT NEC TO TEST FOR is_raspbian_8 OR is_raspbian_9 AS /opt/iiab/iiab/vars/<OS>.yml
# DEFINES THESE AS SUBSETS OF is_debian_8 OR is_debian_9 (FOR NOW!)
- name: Install latest Node.js which includes /usr/bin/npm (debuntu distros up to 2017)
package:
name: nodejs
# name: nodejs=8.x
state: latest
# state: present
when: internet_available and (is_debian_8 or is_debian_9 or is_ubuntu_16 or is_ubuntu_17)
# 2019-01-15: BORROWED BY https://github.com/iiab/iiab/blob/master/roles/nodered/tasks/main.yml#L1-L26
# 2018-07-14: BOTH STEPS ABOVE TAKE TIME, but Raspbian (apt offers npm
# 1.4.21) & Debian 9 (apt offers no npm!) STILL NEED the above
# nodesource.com approach to get a version of npm that works with Sugarizer:
# https://github.com/iiab/iiab/issues/798#issuecomment-404324530
#
# MORE POSITIVELY: this nodesource.com approach (brings in npm 5.6.0 with
# nodejs 8.11.3 for now, to any OS) would also work on Ubuntu 18.04, and
# might even bring about a sane consistency across mainline OS's?
#
# BUT FOR NOW: Ubuntu 18.04's apt (approach below) brings in npm 3.5.2,
# which appears suffic "SO FAR"? 18.04's nodejs 8.10.0 is more reassuring!
# CRAZY IDEA: most versions of npm can upgrade themselves to the latest
# (6.2.0 for now) using command "npm install -g npm", if that helps us in
# future, e.g. TK's memory issue etc? If so, be CAREFUL this puts npm
# in /usr/local/bin on Ubuntu 18.04 -- unlike Ubuntu 16.04 and Raspbian
# where it upgrades /usr/bin/npm in place:
# https://askubuntu.com/questions/1036278/npm-is-incorrect-version-on-latest-ubuntu-18-04-installation
- name: Install latest packages nodejs and npm (debuntu distros after 2017, or other distros)
package:
name:
- nodejs
- npm
state: latest
when: internet_available and not (is_debian_8 or is_debian_9 or is_ubuntu_16 or is_ubuntu_17)
# moved to nodejs
# 4. RUN "npm install" TO POPULATE ~35MB /opt/iiab/sugarizer-server/node_modules