add initial tasks and defaults

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-05-10 16:36:17 +02:00
parent aed4c0fdd7
commit f27e381a6c
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
4 changed files with 56 additions and 0 deletions

18
defaults/main.yml Normal file
View File

@ -0,0 +1,18 @@
---
geth_expo_cont_image: statusteam/geth_exporter:latest
geth_expo_cont_name: geth-exporter
geth_expo_cont_addr: '0.0.0.0'
geth_expo_cont_port: 9200
# consul catalog data
geth_expo_consul_name: 'geth-exporter'
geth_expo_consul_addr: '{{ ansible_local.tinc.vpn_ip }}'
geth_expo_consul_extra_tag: '{{ geth_expo_cont_name }}'
geth_expo_consul_tags:
- '{{ geth_expo_consul_extra_tag }}'
- metrics
- geth
cont_state: started
cont_recreate: false
cont_restart: false

17
tasks/consul.yml Normal file
View File

@ -0,0 +1,17 @@
---
- name: Create Consul service definition
include_role: name=consul-service
vars:
consul_config_name: '{{ geth_expo_cont_name | replace("-", "_") }}'
consul_services:
- name: '{{ geth_expo_consul_name }}'
port: '{{ geth_expo_cont_port }}'
address: '{{ geth_expo_consul_addr }}'
tags: '{{ geth_expo_consul_tags }}'
meta:
container: '{{ geth_expo_cont_name }}'
checks:
- id: '{{ geth_expo_consul_name }}'-health
name: 'geth-exporter healthcheck'
type: http
http: 'http://localhost:{{ geth_expo_cont_port }}/health'

18
tasks/container.yml Normal file
View File

@ -0,0 +1,18 @@
---
- name: 'Start container: {{ geth_expo_cont_name }}'
docker_container:
name: '{{ geth_expo_cont_name }}'
image: '{{ geth_expo_cont_image }}'
user: root
pull: true
restart_policy: always
state: '{{ cont_state }}'
recreate: '{{ cont_recreate }}'
restart: '{{ cont_restart }}'
entrypoint: geth_exporter
volumes_from: '{{ cont_name }}'
command: |
-ipc /data/geth.ipc
-port 9200
ports:
- '{{ geth_expo_cont_port }}:9200/tcp'

3
tasks/main.yml Normal file
View File

@ -0,0 +1,3 @@
---
- import_tasks: container.yml
- import_tasks: consul.yml