-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplaybook.yml
61 lines (48 loc) · 1.25 KB
/
playbook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---
# Ansible playbook for DSP Installation
#
# @author gx1 (2019).
- hosts: all
gather_facts: yes
# vars_files:
# - vars/main.yml
pre_tasks:
- name: Update apt cache if needed.
apt: update_cache=yes cache_valid_time=3600
become: yes
# roles:
# - geerlingguy.firewall
# - geerlingguy.nodejs
tasks:
- name: Install node, npm, git
apt: name={{item}} state=present
with_items:
- nodejs
- npm
- git
- build-essential
become: yes
- name: Download DSP
git:
repo: https://github.com/giper45/DockerSecurityPlayground.git
dest: /home/vagrant/DockerSecurityPlayground
update: yes
- name: Install npm packages
npm:
path: /home/vagrant/DockerSecurityPlayground
- name: Install forever node.js package globally.
npm:
name: forever
global: yes
state: present
become: yes
- name: "Check if DSP is running"
command: forever list
register: forever_list
changed_when: false
- name: "Start DSP."
command: chdir=/home/vagrant/DockerSecurityPlayground/ forever start ./index.js
when: "forever_list.stdout.find('./index.js') == -1"
# handlers:
# - name: restart forever apps
# command: "forever restartall"