Add hopglass-frontend role
This commit is contained in:
parent
a341ff4260
commit
bc6edb2ca3
10 changed files with 183 additions and 0 deletions
41
roles/hopglass-frontend/tasks/install-hopglass.yml
Normal file
41
roles/hopglass-frontend/tasks/install-hopglass.yml
Normal file
|
@ -0,0 +1,41 @@
|
|||
---
|
||||
- name: clone hopglass
|
||||
git:
|
||||
repo: "https://github.com/hopglass/hopglass"
|
||||
dest: "{{ hopglass_frontend_path }}"
|
||||
accept_hostkey: yes
|
||||
update: no
|
||||
|
||||
- name: create build directory
|
||||
file:
|
||||
path: "{{ hopglass_frontend_path }}/build"
|
||||
state: directory
|
||||
|
||||
- name: template config.json
|
||||
template:
|
||||
src: hopglass-config.j2
|
||||
dest: "{{ hopglass_frontend_path }}/build/config.json"
|
||||
|
||||
- name: template nginx site
|
||||
template:
|
||||
src: nginx-site.j2
|
||||
dest: /etc/nginx/conf.d/hopglass.conf
|
||||
register: nginx
|
||||
|
||||
- name: reload nginx
|
||||
service:
|
||||
name: nginx
|
||||
state: reloaded
|
||||
when: nginx.changed
|
||||
|
||||
- name: template make-hopglass-frontend
|
||||
template:
|
||||
src: make-hopglass-frontend.j2
|
||||
dest: /usr/local/bin/make-hopglass-frontend
|
||||
mode: 0755
|
||||
register: make
|
||||
|
||||
- name: show usage information
|
||||
debug:
|
||||
msg: ">>> Because Node.js is terrible, please run make-hopglass-frontend manually. <<<"
|
||||
when: make.changed
|
33
roles/hopglass-frontend/tasks/install-nodejs.yml
Normal file
33
roles/hopglass-frontend/tasks/install-nodejs.yml
Normal file
|
@ -0,0 +1,33 @@
|
|||
---
|
||||
- name: check for npm
|
||||
find:
|
||||
paths: [/bin, /usr/bin, /usr/local/bin]
|
||||
patterns: npm
|
||||
file_type: any
|
||||
register: npm
|
||||
|
||||
- name: install APT HTTPS transport
|
||||
apt:
|
||||
name: apt-transport-https
|
||||
cache_valid_time: 86400
|
||||
when: npm.matched == 0
|
||||
|
||||
- name: add NodeSource signing key
|
||||
apt_key:
|
||||
url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
|
||||
id: 9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280
|
||||
when: npm.matched == 0
|
||||
|
||||
- name: add NodeSource repository
|
||||
apt_repository:
|
||||
repo: "deb https://deb.nodesource.com/{{ nodejs_version }} {{ ansible_lsb.codename }} main"
|
||||
filename: nodesource
|
||||
when: npm.matched == 0
|
||||
|
||||
- name: install Node.js
|
||||
apt:
|
||||
name:
|
||||
- build-essential
|
||||
- nodejs
|
||||
cache_valid_time: 86400
|
||||
when: npm.matched == 0
|
5
roles/hopglass-frontend/tasks/main.yml
Normal file
5
roles/hopglass-frontend/tasks/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
- include: install-nodejs.yml
|
||||
tags: nodejs
|
||||
- include: install-hopglass.yml
|
||||
tags: hopglass-frontend
|
Loading…
Add table
Add a link
Reference in a new issue