improve account vcreation for miners

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-03-19 11:53:21 +01:00
parent 5b124d1aa7
commit 3a7ab8d923
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
5 changed files with 46 additions and 8 deletions

View File

@ -1,5 +1,6 @@
---
# stage contains the network name
miner_network: '{{ stage }}'
miner_account_pass: '{{lookup("passwordstore", "services/faucet/miners-pass")}}'
miner_base_account_addr: '{{lookup("passwordstore", "services/faucet/account-addr")}}'
miner_base_account_pass: '{{lookup("passwordstore", "services/faucet/account-pass")}}'

View File

@ -1,5 +1,16 @@
---
# map of network IDs
miner_network_ids:
frontier: 1
morden: 2
ropsten: 3
rinkeby: 4
miner_network: ~
miner_network_id: '{{ miner_network_ids[miner_network] | mandatory }}'
# miner etherum account
miner_account_pass: ~
# miner reward account
miner_base_account_pass: ~
miner_base_account_addr: ~
@ -8,6 +19,7 @@ miner_cont_image: 'ethereum/client-go:{{ miner_cont_tag }}'
miner_cont_name: 'geth-miner'
miner_cont_vol: '/docker/{{ miner_cont_name }}'
miner_extra_data: 'Status.im Miner'
miner_main_port: 30303
miner_rpc_port: 8545
miner_max_peers: 35

View File

@ -0,0 +1,30 @@
---
- name: Create container folders
file:
path: '{{ miner_cont_vol }}/data'
state: directory
mode: 0750
owner: dockremap
group: docker
- name: Create account password file
copy:
dest: '{{ miner_cont_vol }}/data/account.pass'
content: '{{ miner_account_pass }}'
mode: 0750
owner: dockremap
group: docker
- name: Create miner account
docker_container:
name: 'miner-account-gen'
image: '{{ miner_cont_image }}'
user: root
pull: true
command: |
account new
--datadir=/data
--password=/data/account.pass
volumes:
- '{{ miner_cont_vol }}/data:/data:rw'

View File

@ -1,11 +1,4 @@
---
- name: Create container folders
file:
path: '{{ miner_cont_vol }}/data'
state: directory
owner: dockremap
group: docker
- name: Create geth miner
docker_container:
name: '{{ miner_cont_name }}'
@ -20,8 +13,9 @@
- '127.0.0.1:{{ miner_rpc_port }}:{{ miner_rpc_port }}'
- '{{ miner_main_port }}:{{ miner_main_port }}'
command: |
--{{ miner_network | mandatory }}
--networkid={{ miner_network_id }}
--datadir=/data
--password=/data/account.pass
--shh
--shh.pow={{ miner_shh_pow }}
--rpc

View File

@ -1,4 +1,5 @@
---
- import_tasks: config.yml
- import_tasks: container.yml
- import_tasks: firewall.yml
- import_tasks: consul.yml