-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplaybookcentos.yml
More file actions
47 lines (35 loc) · 1.37 KB
/
playbookcentos.yml
File metadata and controls
47 lines (35 loc) · 1.37 KB
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
---
- hosts: localhost
become: yes
vars:
node_apps_location: /usr/local/opt/node
tasks:
#- name: Install EPEL repo.
# yum: name=epel-release state=present
#- name: Import Remi GPG key.
# rpm_key:
# key: "https://rpms.remirepo.net/RPM-GPG-KEY-remi"
# state: present
#- name: Install Remi repo.
# yum:
# name: "https://rpms.remirepo.net/enterprise/remi-release-7.rpm"
# state: present
- name: Ensure firewalld is stopped (since this is a test server).
service: name=firewalld state=stopped
- name: Install Node.js and npm.
yum: name=npm state=present enablerepo=epel
- name: Install Forever (to run our Node.js app).
npm: name=forever global=yes state=present
- name: Ensure Node.js app folder exists.
file: "path={{ node_apps_location }} state=directory"
- name: Copy example Node.js app to server.
copy: "src=app dest={{ node_apps_location }}"
- name: Install app dependencies defined in package.json.
npm: "path={{ node_apps_location }}/app"
- name: Check list of running Node.js apps.
command: forever list
register: forever_list
changed_when: false
- name: Start example Node.js app.
command: "forever start {{ node_apps_location }}/app/app.js"
when: "forever_list.stdout.find(node_apps_location + '/app/app.js') == -1"