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

99 lines
3.3 KiB
YAML
Raw Normal View History

2017-05-27 18:09:50 +00:00
- name: Download the latest stable version of sugarizer from location under our control
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
#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
- name: Set up apt sources on is_debuntu
shell: curl -sL https://deb.nodesource.com/setup_6.x | bash -
when: internet_available and is_debuntu
- name: Install nodejs=6.* which includes /usr/bin/npm - is_debuntu
package: name=nodejs=6.*
2017-05-27 18:09:50 +00:00
state=present
2017-09-22 07:14:14 +00:00
when: internet_available and is_debuntu
- name: Install npm non is_debuntu
2017-09-22 07:14:14 +00:00
package: name={{ item }}
state=present
when: internet_available and not is_debuntu
2017-09-22 07:14:14 +00:00
with_items:
- nodejs
- npm
2017-10-20 01:16: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
- name: set a flag to abort second attempt to install
set_fact:
2017-09-04 18:43:00 +00:00
npm_exists: True
when: npm.stat.exists is defined and npm.stat.exists
2017-09-04 18:43:00 +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:
- { 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
- name: Create the express framework for node.js - ALL less F18
2017-05-27 18:09:50 +00:00
shell: npm install
args:
chdir: "{{ sugarizer_location }}/sugarizer/server"
2017-05-27 18:09:50 +00:00
creates: "{{ sugarizer_location }}/sugarizer/server/node_modules"
when: not is_F18 and not npm_exists
2017-05-27 18:09:50 +00:00
- name: Create the express framework for node.js - F18
2017-05-27 18:09:50 +00:00
shell: npm install
args:
chdir: "{{ sugarizer_location }}/sugarizer/server"
when: is_F18 and not npm_exists
2017-05-27 18:09:50 +00:00
- name: enable services - All
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
- name: disable services - All
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
- name: add sugarizer to service list
ini_file: dest='{{ service_filelist }}'
section=sugarizer
option='{{ item.option }}'
value='"{{ item.value }}"'
with_items:
- option: name
value: Sugarizer
- option: description
value: '"The Sugar Learning Platform is a leading learning platform that began in the famous One Laptop Per Child project. Sugarizer is a web implementation of that platform"'
2017-05-27 18:09:50 +00:00
- option: enabled
value: "{{ sugarizer_enabled }}"