forked from chrisvugrinec/demo-ethereumonazure
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig-eth.yaml
112 lines (112 loc) · 3.34 KB
/
config-eth.yaml
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
---
- hosts: eth-cluster
gather_facts: True
vars:
remote_user: vsts
tasks:
- name: Setting facts
set_fact:
gethdir: '/opt/ethereum/demo-eko'
gethsolidedir: '/opt/ethereum/solidity-ide'
gethclientdir: '/opt/ethereum/demo-eko-client'
gethnodeport: 30303
gethpassword: 'helloworld123'
user: 'vsts'
- name: Kill existing geth node
shell: "(kill $(ps -ef | grep -i geth | grep networkid | awk '{print $2}') >/dev/null 2>&1 &)"
async: 10
poll: 0
- name: Making sure that geth node is killed
wait_for:
port: "{{gethnodeport}}"
state: drained
- file:
path: "{{gethdir}}"
owner: "{{user}}"
group: "{{user}}"
state: directory
mode: 0755
become: true
become_user: root
- file:
path: "{{gethclientdir}}"
owner: "{{user}}"
group: "{{user}}"
state: directory
mode: 0755
become: true
become_user: root
- file:
path: "{{gethsolidedir}}"
owner: "{{user}}"
group: "{{user}}"
state: directory
mode: 0755
become: true
become_user: root
- name: Extract Solidity Eth Ide
unarchive:
src: solidity-ide/sol.tar.gz
dest: "{{gethsolidedir}}"
- copy:
src: ethereum/genesis-block.json
dest: "{{gethdir}}"
- name: Extract Netstat Eth Client
unarchive:
src: ethereum-client/eth-net-intelligence-api.tar.gz
dest: "{{gethclientdir}}"
- name: Install Go
apt: name=golang state=installed
become: true
become_user: root
- name: Install npm
apt: name=npm state=installed
become: true
become_user: root
- apt_repository:
repo: 'ppa:ethereum/ethereum'
become: true
become_user: root
- name: Install Ethereum
apt: name=ethereum state=installed
become: true
become_user: root
- name: Initialize private ETH network
shell: geth --datadir "{{gethdir}}" init "{{gethdir}}"/genesis-block.json
- name: install netstats client
shell: cd "{{gethclientdir}}"; npm install; npm install -g pm2
become: true
become_user: root
- name: Start geth node
shell: "(geth --datadir \"{{gethdir}}\" --networkid \"999\" --rpc --rpcport \"8545\" --rpcaddr \"0.0.0.0\" --rpccorsdomain \"*\" --rpcapi \"eth,net,web3,debug\" >/dev/null 2>&1 &)"
async: 10
poll: 0
- name: Wait for geth node to come up
wait_for:
port: "{{gethnodeport}}"
delay: 10
- name: nodejs bugfix
shell: "ln -s /usr/bin/nodejs /usr/bin/node"
ignore_errors: yes
become: true
become_user: root
- name: Generate eth Account
shell: "echo 'personal.newAccount(\"{{gethpassword}}\")' | geth attach ipc:\"{{gethdir}}\"/geth.ipc"
- name: Starting miner
shell: "(echo 'miner.start(3)' | geth attach ipc:\"{{gethdir}}\"/geth.ipc >/dev/null 2>&1 &)"
async: 10
poll: 0
- name: Generate enode data
shell: "(echo admin.nodeInfo.enode | geth attach ipc:\"{{gethdir}}\"/geth.ipc | grep enode >/tmp/enode)"
- name: Get enode value and assign to var
shell: "(cat /tmp/enode)"
register: enode
# STARTING ETH NETSTAT CLIENT
- name: Start eth net stat client
shell: cd "{{gethclientdir}}"/eth-net-intelligence-api; pm2 start /tmp/pm2-template*.json
- file: path=/tmp/enodes state=touch
- name: Generating tmp file
blockinfile:
path: /tmp/enodes
block: |
{{ enode.stdout }}