-
Notifications
You must be signed in to change notification settings - Fork 5
/
install-tools.yml
114 lines (93 loc) · 2.65 KB
/
install-tools.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
---
- hosts: all
remote_user: root
tasks:
- name: Install required debs
apt:
name: "{{ item }}"
state: present
with_items:
- unzip
- curl
- software-properties-common
- build-essential
- git
- nginx
- name: Unarchive project
unarchive:
src: /root/download.zip
dest: /root/
remote_src: no
- name: register root contents
shell: "ls"
args:
chdir: "/root"
register: dirs
- name: Disable dpkg fsync
shell: echo force-unsafe-io > /etc/dpkg/dpkg.cfg.d/unsafe-io
args:
creates: /etc/dpkg/dpkg.cfg.d/unsafe-io
- name: Install dirmngr
apt:
name: dirmngr
state: present
- name: Install apt-transport-https
apt:
name: apt-transport-https
state: present
- name: Add ethereum repo key
apt_key:
id: 1C52189C923F6CA9
keyserver: keyserver.ubuntu.com
- name: Add node repo key
apt_key:
id: 1655A0AB68576280
keyserver: keyserver.ubuntu.com
- name: Add node repo
apt_repository:
repo: deb http://ppa.launchpad.net/ethereum/ethereum/ubuntu xenial main
state: present
- name: Add node repo
apt_repository:
repo: deb https://deb.nodesource.com/node_8.x stretch main
state: present
- name: Upgrade debian
apt:
update_cache: true
upgrade: true
- name: Install required debs
apt:
name: "{{ item }}"
state: present
with_items:
- nodejs
- name: Install npm packages
npm: path=/root/{{dirs.stdout_lines[0]}}
- name: copy config.json
template:
src: config.json.j2
dest: /root/{{dirs.stdout_lines[0]}}/config.json
- name: install truffle
shell: "npm install truffle -g"
- name: unlock geth account
command: chdir=/root/{{dirs.stdout_lines[0]}} node unlock.js
- name: migrate contracts
command: truffle migrate --network production --reset
args:
chdir: /root/{{dirs.stdout_lines[0]}}
- name: build static files
command: npm run build
args:
chdir: /root/{{dirs.stdout_lines[0]}}
- name: copy static file into nginx folder
shell: "cp -r /root/{{dirs.stdout_lines[0]}}/build/* /var/www/html/"
- name: remove nginx default config
shell: "rm -rf /etc/nginx/sites-enabled/default"
- name: copy nginx conf
template:
src: app.conf
dest: /etc/nginx/sites-enabled/
- name: Restart service nginx
service:
name: nginx
state: restarted