reorg tasks
This commit is contained in:
70
tasks/server/prometheus.yml
Normal file
70
tasks/server/prometheus.yml
Normal file
@ -0,0 +1,70 @@
|
||||
---
|
||||
- name: 'prometheus | server | assert | check mandatory vars are defined'
|
||||
assert:
|
||||
that:
|
||||
- "prometheus_server_monitor is defined"
|
||||
tags:
|
||||
- prometheus
|
||||
|
||||
- name: 'prometheus | server | create docker network'
|
||||
docker_network:
|
||||
name: 'prometheus'
|
||||
tags:
|
||||
- prometheus
|
||||
|
||||
- name: 'prometheus | server | create docker volume data'
|
||||
docker_volume:
|
||||
name: prometheus_data
|
||||
register: register_docker_volume_prometheus__prometheus_data
|
||||
tags:
|
||||
- prometheus
|
||||
|
||||
- name: 'prometheus | server | create prometheus directory to /etc'
|
||||
file:
|
||||
path: /etc/prometheus
|
||||
state: directory
|
||||
mode: '0755'
|
||||
tags:
|
||||
- prometheus
|
||||
|
||||
- name: 'prometheus | server | copy config prometheus yml'
|
||||
template:
|
||||
src: conf/prometheus.yml.j2
|
||||
dest: /etc/prometheus/prometheus.yml
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
tags:
|
||||
- prometheus
|
||||
notify:
|
||||
- 'prometheus | server | restart container'
|
||||
|
||||
- name: 'prometheus | server | deploy container'
|
||||
docker_container:
|
||||
name: prometheus
|
||||
hostname: '{{ inventory_hostname }}'
|
||||
image: prom/prometheus:{{ prometheus_server_version }}
|
||||
volumes:
|
||||
- /etc/prometheus/:/etc/prometheus/
|
||||
- prometheus_data:/prometheus
|
||||
command:
|
||||
- '--config.file=/etc/prometheus/prometheus.yml'
|
||||
- '--storage.tsdb.path=/prometheus'
|
||||
- '--storage.tsdb.retention.time={{ prometheus_retention_time }}'
|
||||
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
|
||||
- '--web.console.templates=/usr/share/prometheus/consoles'
|
||||
- '--web.enable-admin-api'
|
||||
networks:
|
||||
- { name: prometheus }
|
||||
ports:
|
||||
- "9090:9090"
|
||||
log_driver: syslog
|
||||
log_options:
|
||||
tag: docker_prometheus
|
||||
restart_policy: 'unless-stopped'
|
||||
pull: '{{ awh_services_docker_pull }}'
|
||||
etc_hosts: '{{ prometheus_nodes_ip }}'
|
||||
tags:
|
||||
- prometheus
|
||||
notify:
|
||||
- 'prometheus | server | restart container'
|
Reference in New Issue
Block a user