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

112 lines
3.6 KiB
YAML
Raw Normal View History

2017-11-20 04:25:54 +00:00
- name: Download latest stable Sugarizer from location we control
get_url:
url: "{{ iiab_download_url }}/{{ sugarizer_version }}.tar.gz"
dest: "{{ downloads_dir }}/{{ sugarizer_version }}.tar.gz"
2017-11-20 04:20:39 +00:00
- name: Untar to /library/www/html/{{ sugarizer_version }}
unarchive:
src: "{{ downloads_dir }}/{{ sugarizer_version }}.tar.gz"
2017-11-20 04:05:24 +00:00
dest: "{{ sugarizer_location }}"
creates: "{{ sugarizer_location }}/{{ sugarizer_version }}/index.html"
# command: tar xzf {{ downloads_dir }}/{{ sugarizer_version }}.tar.gz -C {{ sugarizer_location }}
# creates="{{ sugarizer_location }}/{{ sugarizer_version }}/index.html"
2017-05-27 18:09:50 +00:00
2017-11-20 04:20:39 +00:00
- name: Create symbolic link /library/www/html/sugarizer
file:
src: "{{ sugarizer_location }}/{{ sugarizer_version }}"
dest: "{{ sugarizer_location }}/sugarizer"
2017-11-20 04:09:54 +00:00
state: link
2017-05-27 18:09:50 +00:00
2017-11-14 03:35:41 +00:00
- name: Set up Node.js 6.x apt sources (debuntu)
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)
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
- name: Install npm (OS's other than debuntu)
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-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
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
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: root
group: root
mode: 0644
2017-05-27 18:09:50 +00:00
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
2017-11-14 03:35:41 +00:00
- name: Create the express framework for Node.js (OS's other than Fedora 18)
shell: npm install
2017-05-27 18:09:50 +00:00
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
2017-11-14 03:35:41 +00:00
- name: Create the express framework for Node.js (Fedora 18)
shell: npm install
2017-05-27 18:09:50 +00:00
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 OS's)
service:
name: "{{ item.name }}"
enabled: yes
state: restarted
2017-09-22 07:14:14 +00:00
with_items:
- { name: sugarizer }
when: sugarizer_enabled
2017-05-27 18:09:50 +00:00
- name: Disable services (all OS's)
service:
name: "{{ item.name }}"
enabled: no
state: stopped
2017-09-22 07:14:14 +00:00
with_items:
- { name: sugarizer }
2017-09-22 07:14:14 +00:00
when: not sugarizer_enabled
2017-05-27 18:09:50 +00:00
2017-11-27 01:05:27 +00:00
- name: Add 'sugarizer' to list of services at /etc/iiab/iiab.ini
ini_file:
2017-11-20 04:02:07 +00:00
dest: "{{ service_filelist }}"
section: sugarizer
option: "{{ item.option }}"
value: "{{ item.value }}"
2017-05-27 18:09:50 +00:00
with_items:
2017-11-27 01:10:42 +00:00
- option: name
value: Sugarizer
- option: description
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."'
- option: enabled
value: "{{ sugarizer_enabled }}"