-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoctofarm_playbook.yml
58 lines (56 loc) · 1.5 KB
/
octofarm_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
---
- hosts: localhost
tasks:
- name: Add an Apt signing key for Node 12
apt_key:
url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
state: present
become: yes
- name: Add Node 12 repository into sources list
apt_repository:
repo: deb https://deb.nodesource.com/node_12.x focal main
state: present
become: yes
- name: Install Octofarm apt dependencies
become: yes
apt:
update_cache: yes
pkg:
- git
- build-essential
- nodejs
- gcc
- g++
- make
- mongodb
- name: Git checkout
git:
repo: 'https://github.com/NotExpectedYet/OctoFarm.git'
dest: ~/OctoFarm
depth: "1"
force: yes # Does this break things? We shall see
- name: Start MongoDB
become: yes
systemd:
state: restarted
daemon_reload: yes
enabled: yes
name: mongodb
- name: Install pm2
shell: npm install pm2 -g
become: yes
- name: Start OctoFarm
args:
chdir: ~/OctoFarm/
shell: pm2 stop OctoFarm ; npm start
- name: Workaround for first start of PM2 - ignore this
shell: pm2 startup #Run this once to get past their stupid splash screen, ignore it, then run it for real next time
ignore_errors: yes
- name: Generate pm2 startup scripts
shell: pm2 startup | sed -n 3p | bash #Get the 3rd line of output from startup command and run it as sudo
args:
chdir: ~/OctoFarm/
- name: Save pm2 setup
shell: pm2 save
args:
chdir: ~/OctoFarm/