Add hopglass-frontend role

This commit is contained in:
Alexander Dietrich 2018-11-03 00:00:16 +01:00
commit bc6edb2ca3
10 changed files with 183 additions and 0 deletions

View 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

View 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

View file

@ -0,0 +1,5 @@
---
- include: install-nodejs.yml
tags: nodejs
- include: install-hopglass.yml
tags: hopglass-frontend