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

Update main.yml

This commit is contained in:
A Holt 2018-07-14 09:22:50 -04:00 committed by GitHub
parent 27871463cb
commit 81412a6265
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -31,6 +31,10 @@
# Going forward let's "git clone" IIAB's preferred versions, of sugarizer # Going forward let's "git clone" IIAB's preferred versions, of sugarizer
# AND sugarizer-server, as specified in roles/sugarizer/defaults/main.yml # AND sugarizer-server, as specified in roles/sugarizer/defaults/main.yml
# 2018-07-14 BLOWBACK: git works well BUT even with "depth: 1"
# - 229MB is unfort downloaded to /opt/iiab/sugarizer/.git
# - 1.4MB is unfort downloaded to /opt/iiab/sugarizer-server/.git
- name: Clone llaske/sugarizer-server ({{ sugarizer_server_git_version }}) from GitHub to /opt/iiab - name: Clone llaske/sugarizer-server ({{ sugarizer_server_git_version }}) from GitHub to /opt/iiab
git: git:
repo: https://github.com/llaske/sugarizer-server repo: https://github.com/llaske/sugarizer-server
@ -48,8 +52,8 @@
# 3. INSTALL A GOOD VERSION OF Node.js AND npm # 3. INSTALL A GOOD VERSION OF Node.js AND npm
# Both Raspbian and Debian 9 STILL need this approach as of July 2018, # Raspbian & Debian 9 STILL need this approach (July 2018) to get a recent
# as documented at https://github.com/iiab/iiab/issues/798#issuecomment-404324530 # version of npm. As documented at https://github.com/iiab/iiab/issues/798#issuecomment-404324530
- name: Set up Node.js 8.x apt sources (debuntu but avoid ubuntu-18) - name: Set up Node.js 8.x apt sources (debuntu but avoid ubuntu-18)
shell: curl -sL https://deb.nodesource.com/setup_8.x | bash - shell: curl -sL https://deb.nodesource.com/setup_8.x | bash -
when: internet_available and is_debuntu and not is_ubuntu_18 when: internet_available and is_debuntu and not is_ubuntu_18
@ -57,56 +61,60 @@
- name: Install latest Node.js which includes /usr/bin/npm (debuntu but avoid ubuntu-18) - name: Install latest Node.js which includes /usr/bin/npm (debuntu but avoid ubuntu-18)
package: package:
name: nodejs name: nodejs
# name: nodejs=8.x
state: latest state: latest
# name: nodejs=8.x
# state: present # state: present
when: internet_available and is_debuntu and not is_ubuntu_18 when: internet_available and is_debuntu and not is_ubuntu_18
- name: Install Node.js and npm (ubuntu-18) #- name: Install Node.js and npm (ubuntu-18)
- name: Install Node.js and npm (ubuntu-18 or not is_debuntu)
package: package:
name: "{{ item }}" name: "{{ item }}"
state: latest state: latest
when: internet_available and is_ubuntu_18 when: internet_available and (is_ubuntu_18 or (not is_debuntu))
with_items: with_items:
- nodejs - nodejs
- npm - npm
- name: Install npm (OS's other than debuntu) #- name: Install npm (OS's other than debuntu)
package: # package:
name: "{{ item }}" # name: "{{ item }}"
state: present # state: present
when: internet_available and not is_debuntu # when: internet_available and not is_debuntu
with_items: # with_items:
- nodejs # - nodejs
- npm # - npm
# 4. RUN "npm install" TO POPULATE ~35MB /opt/iiab/sugarizer-server/node_modules # 4. RUN "npm install" TO POPULATE ~35MB /opt/iiab/sugarizer-server/node_modules
# Re-running "npm install" fails on Raspbian 9 if not other OS's # OLD WAY: Re-running "npm install" fails on Raspbian 9 if not other OS's, so...
- name: Check for /opt/iiab/{{ sugarizer_server_version }}/node_modules
stat:
path: "{{ sugarizer_location }}/{{ sugarizer_server_version }}/node_modules"
register: nmtest
ignore_errors: true
- name: Set a flag to prevent re-running of "npm install" #- name: Check for /opt/iiab/{{ sugarizer_server_version }}/node_modules
set_fact: # stat:
node_modules_exists: True # path: "{{ sugarizer_location }}/{{ sugarizer_server_version }}/node_modules"
when: nmtest.stat is defined and nmtest.stat.exists # register: nmtest
# ignore_errors: true
#
#- name: Set a flag to prevent re-running of "npm install"
# set_fact:
# node_modules_exists: True
# when: nmtest.stat is defined and nmtest.stat.exists
- name: Create the express framework for Node.js (OS's other than Fedora 18) # NEW WAY: "creates: ..." below (checks for existence of "node_modules")
#- name: Create the express framework for Node.js (OS's other than Fedora 18)
- name: Run 'npm install' to create the express framework for Node.js
shell: npm install shell: npm install
args: args:
chdir: "{{ sugarizer_location }}/{{ sugarizer_server_version }}" chdir: "{{ sugarizer_location }}/{{ sugarizer_server_version }}"
creates: "{{ sugarizer_location }}/{{ sugarizer_server_version }}/node_modules" creates: "{{ sugarizer_location }}/{{ sugarizer_server_version }}/node_modules"
#creates: "{{ sugarizer_location }}/{{ sugarizer_server_version }}/server/node_modules" # when: not is_F18 and not node_modules_exists
when: not is_F18 and not node_modules_exists
- name: Create the express framework for Node.js (Fedora 18) #- name: Create the express framework for Node.js (Fedora 18)
shell: npm install # shell: npm install
args: # args:
chdir: "{{ sugarizer_location }}/sugarizer/server" # chdir: "{{ sugarizer_location }}/sugarizer/server"
when: is_F18 and not node_modules_exists # when: is_F18 and not node_modules_exists
# 5. PLACE CONFIG FILES # 5. PLACE CONFIG FILES