2017-10-27 14:23:08 +00:00
- name : Download the latest stable version of Sugarizer from location under our control
2017-06-09 23:25:56 +00:00
get_url : url={{ iiab_download_url }}/{{ sugarizer_version }}.tar.gz
2017-05-27 18:09:50 +00:00
dest={{ downloads_dir }}/{{ sugarizer_version }}.tar.gz
2017-10-19 06:33:02 +00:00
2017-10-12 19:33:10 +00:00
#fixme
2017-05-27 18:09:50 +00:00
- name : Untar it to target location
command : tar xzf {{ downloads_dir }}/{{ sugarizer_version }}.tar.gz -C {{ sugarizer_location }}
2017-09-22 07:14:14 +00:00
creates="{{ sugarizer_location }}/{{ sugarizer_version }}/index.html"
2017-05-27 18:09:50 +00:00
- name : Create a symbolic link from generic url to version specific location
file : dest={{ sugarizer_location }}/sugarizer
src={{ sugarizer_location }}/{{ sugarizer_version }}
state=link
2017-11-14 03:35:41 +00:00
- name : Set up Node.js 6.x apt sources (debuntu)
2017-10-17 22:12:40 +00:00
shell : curl -sL https://deb.nodesource.com/setup_6.x | bash -
when : internet_available and is_debuntu
2017-11-14 03:35:41 +00:00
- name : Install latest Node.js which includes /usr/bin/npm (debuntu)
2017-11-14 03:19:36 +00:00
package : name=nodejs
state=latest
# package: name=nodejs=6.*
# state=present
2017-09-22 07:14:14 +00:00
when : internet_available and is_debuntu
2017-07-04 20:27:44 +00:00
2017-11-10 19:45:51 +00:00
- name : Install npm (OS's other than debuntu)
2017-09-22 07:14:14 +00:00
package : name={{ item }}
2017-07-04 20:27:44 +00:00
state=present
2017-10-17 22:12:40 +00:00
when : internet_available and not is_debuntu
2017-09-22 07:14:14 +00:00
with_items :
- nodejs
- npm
2017-07-04 20:27:44 +00:00
2017-10-27 14:23:08 +00:00
# attempting to reinstall npm is broken on Raspbian 9
- name : Check for Sugarizer already installed
2017-09-04 18:43:00 +00:00
stat : path={{ sugarizer_location }}/sugarizer/server/node_modules
register : npm
2017-10-27 14:23:08 +00:00
- name : Set a flag to abort second attempt to install
2017-10-13 14:03:46 +00:00
set_fact :
2017-09-04 18:43:00 +00:00
npm_exists : True
2017-09-08 03:07:36 +00:00
when : npm.stat.exists is defined and npm.stat.exists
2017-09-04 18:43:00 +00:00
2017-10-19 06:33:02 +00:00
- name : Create systemd files and copy our ini file
2017-05-27 18:09:50 +00:00
template : src={{ item.src }}
dest={{ item.dest }}
owner=root
group=root
mode=0644
with_items :
2017-10-12 19:33:10 +00:00
- { src: 'sugarizer.service.j2' , dest : '/etc/systemd/system/sugarizer.service' }
2017-05-27 18:09:50 +00:00
- { src: 'sugarizer.ini' , dest : '{{ sugarizer_location }}/sugarizer/server' }
# - { src: 'sugarizer.conf' , dest: '/etc/apache2/sites-available' }
#- name: Create the symlink enabling the rewrite
# file: src=/etc/apache2/sites-available/sugarizer.conf
# dest=/etc/apache2/sites-enabled/sugarizer.conf
# state=link
2017-11-14 03:35:41 +00:00
- name : Create the express framework for Node.js (OS's other than Fedora 18)
2017-05-27 18:09:50 +00:00
shell : npm install
args :
2017-10-19 06:33:02 +00:00
chdir : "{{ sugarizer_location }}/sugarizer/server"
2017-05-27 18:09:50 +00:00
creates : "{{ sugarizer_location }}/sugarizer/server/node_modules"
2017-10-13 14:03:46 +00:00
when : not is_F18 and not npm_exists
2017-05-27 18:09:50 +00:00
2017-11-14 03:35:41 +00:00
- name : Create the express framework for Node.js (Fedora 18)
2017-05-27 18:09:50 +00:00
shell : npm install
args :
2017-10-19 06:33:02 +00:00
chdir : "{{ sugarizer_location }}/sugarizer/server"
2017-10-13 14:03:46 +00:00
when : is_F18 and not npm_exists
2017-05-27 18:09:50 +00:00
2017-11-10 19:45:51 +00:00
- name : Enable services (all OS's)
2017-09-22 07:14:14 +00:00
service : name={{ item.name }}
enabled=yes
state=restarted
with_items :
- { name : sugarizer }
when : sugarizer_enabled
2017-05-27 18:09:50 +00:00
2017-11-10 19:45:51 +00:00
- name : Disable services (all OS's)
2017-09-22 07:14:14 +00:00
service : name={{ item.name }}
enabled=no
state=stopped
with_items :
- { name : sugarizer }
when : not sugarizer_enabled
2017-05-27 18:09:50 +00:00
2017-11-10 19:45:51 +00:00
- name : Add 'sugarizer' to service list
2017-11-17 04:15:29 +00:00
ini_file : dest="{{ service_filelist }}"
2017-05-27 18:09:50 +00:00
section=sugarizer
2017-11-17 04:15:29 +00:00
option="{{ item.option }}"
value="{{ item.value }}"
2017-05-27 18:09:50 +00:00
with_items :
- option : name
value : Sugarizer
- option : description
2017-11-02 06:35:35 +00:00
value : '"The Sugar Learning Platform began with the famous One Laptop Per Child project, written in Python. Sugarizer is the new HTML/JavaScript implementation of Sugar, usable in most all browsers."'
2017-05-27 18:09:50 +00:00
- option : enabled
value : "{{ sugarizer_enabled }}"