This repository has been archived by the owner on Feb 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gmpvpc.yml
132 lines (111 loc) · 2.65 KB
/
gmpvpc.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
---
- name: GMPVPC-3000
hosts: rpi
become: yes
become_user: root
tasks:
- name: Install apt-transport-https
apt:
name: apt-transport-https
state: latest
- name: Add NodeJS GPG key
apt_key:
url: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key"
state: present
- name: Add NodeJS repository
apt_repository:
repo: "deb https://deb.nodesource.com/node_8.x stretch main"
- name: Add NodeJS source repository
apt_repository:
repo: "deb-src https://deb.nodesource.com/node_8.x stretch main"
- name: Update APT repositories
apt:
update_cache: yes
upgrade: dist
- name: Install PostgreSQL
apt:
name: postgresql
state: latest
- name: Install RabbitMQ
apt:
name: rabbitmq-server
state: latest
- name: Add user 'gmpvpc' to AMQP
rabbitmq_user:
user: gmpvpc
password: gmpvpc
- name: Install NodeJS
apt:
name: nodejs
install_recommends: yes
state: latest
- name: Install build essentials
apt:
name: build-essential
install_recommends: yes
state: latest
- name: Install InfluxDB
apt:
name: influxdb
state: latest
- name: Check that PostgreSQL is running
systemd:
name: postgresql
state: started
- name: Check that InfluxDB is running
systemd:
name: influxdb
state: started
- name: Create UNIX user named 'gmpvpc'
user:
name: gmpvpc
state: present
- name: checkout git repo
become: no
local_action:
module: git
repo: git@gmpvpc.ddns.net:gmpvpc/gmpvpc-ble.git
dest: /tmp/gmpvpc-ble/
- name: Push app to remote server
synchronize:
recursive: yes
use_ssh_args: yes
mode: push
src: /tmp/gmpvpc-ble/
dest: /home/gmpvpc/gmpvpc-ble/
rsync_opts:
- "--exclude=.git"
- "--chown=gmpvpc:gmpvpc"
- name: Run NPM install
become: yes
become_user: gmpvpc
npm:
path: /home/gmpvpc/gmpvpc-ble/
- name: Build the app using 'npm run build'
become: yes
become_user: gmpvpc
command: npm run build
args:
chdir: ~/gmpvpc-ble/
- name: Push startup script
synchronize:
use_ssh_args: yes
mode: push
src: ./gmpvpcd
dest: /usr/bin/
rsync_opts:
- "--chown=root:root"
- name: Push service unit
synchronize:
use_ssh_args: yes
mode: push
src: ./gmpvpc.service
dest: /etc/systemd/system/
rsync_opts:
- "--chown=root:root"
- name: Enabling and starting service
systemd:
name: gmpvpc
daemon_reload: yes
enabled: yes
state: started