You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.2 KiB

3 years ago
---
- hosts: service
remote_user: docker
gather_facts: no
3 years ago
become: yes
3 years ago
vars:
user: "docker"
3 years ago
NODEJS_VERSION: "14"
3 years ago
ansible_distribution_release: "xenial" #trusty
3 years ago
tasks:
- name: Copy files to workers
3 years ago
become: true
3 years ago
git:
repo: https://git.swarmlab.io:3000/Lefteris/dummyservice.git
3 years ago
dest: /project/courses/dummy
3 years ago
force: yes
3 years ago
- name: Install the gpg key for nodejs LTS
apt_key:
url: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key"
state: present
- name: Install the nodejs LTS repos
apt_repository:
repo: "deb https://deb.nodesource.com/node_{{ NODEJS_VERSION }}.x {{ ansible_distribution_release }} main"
state: present
3 years ago
# update_cache: yes
3 years ago
- name: Install the nodejs
3 years ago
become: true
3 years ago
apt:
3 years ago
name: nodejs
state: present
3 years ago
# - name: Install npm
# become: true
# apt:
# name: npm
# state: present
3 years ago
- name: install dependencies
3 years ago
command: npm install
args:
3 years ago
chdir: "/project/courses/dummy/swarmlab-app/src"
3 years ago
- name: Build app
3 years ago
command: npm run start
args:
3 years ago
chdir: "/project/courses/dummy/swarmlab-app/src"