infra-role-geth/tasks/container.yml

52 lines
1.6 KiB
YAML

---
- name: Geth | Create the container
docker_container:
name: '{{ geth_cont_name }}'
image: '{{ geth_cont_image }}'
user: root
pull: true
restart_policy: always
state: '{{ cont_state }}'
recreate: '{{ cont_recreate }}'
restart: '{{ cont_restart }}'
# some limits due to statusd hogging resources
memory: '{{ cont_mem_limit }}m'
memory_swap: '{{ cont_swap_limit }}m'
ports:
- '{{ geth_port }}:{{ geth_port }}/tcp'
- '{{ geth_port }}:{{ geth_port }}/udp'
- '{{ geth_rpc_addr }}:{{ geth_rpc_port }}:{{ geth_rpc_port }}'
command: |
{% if geth_network_name in ("ropsten", "testnet") %}
--testnet
{% elif geth_network_name == "rinkeby" %}
--rinkeby
{% elif geth_network_name == "goerli" %}
--goerli
{% endif %}
{% if geth_v5disc_enabled %}
--v5disc
{% endif %}
--syncmode={{ geth_sync_mode }}
{% if geth_sync_mode != 'light' %}
--lightserv={{ geth_light_serv }}
{% endif %}
--verbosity={{ geth_log_level_id }}
--cache={{ geth_cache }}
--maxpeers={{ geth_max_peers }}
--port={{ geth_port }}
--nat=extip:{{ geth_public_addr }}
--unlock={{ geth_account_addr }}
--datadir=/data
--password=/keys/account.pass
--keystore=/keys
--rpc
--rpcaddr=0.0.0.0
--rpcport={{ geth_rpc_port }}
--rpcvhosts={{ geth_aliases | join(",") }}
--rpcapi={{ geth_rcp_api }}
volumes:
- '{{ geth_cont_vol }}/keys:/keys:rw'
# WARNING: This assumes /data is mounted, see bootstrap role
- '{{ geth_data_path }}:/data:rw'