ansible-debops-infrastructure

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.erethon.com/ansible-debops-infrastructure
Log | Files | Refs

commit 1ca195fea52f5baf3e324dbc91ebde9dfa16a541
parent 22396cc1acd06452fb39ec0e7de4b639c469caec
Author: Dionysis Grigoropoulos <dgrig@erethon.com>
Date:   Mon, 18 Jun 2018 23:32:44 +0300

prometheus: Init role and link this with grafana

Diffstat:
ansible/inventory/group_vars/grafana/all.yml | 4+++-
ansible/roles/prometheus/tasks/main.yml | 40++++++++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/ansible/inventory/group_vars/grafana/all.yml b/ansible/inventory/group_vars/grafana/all.yml @@ -1,5 +1,7 @@ --- -grafana__volume: '/data/volumes/grafana' grafana__admin_user: '{{ lookup("password", secret + "/credentials/grafana/admin_user") }}' grafana__admin_password: '{{ lookup("password", secret + "/credentials/grafana/admin_password") }}' +grafana__private_ip: '192.168.122.5' +grafana__port: '80' +grafana__name: 'grafana' diff --git a/ansible/roles/prometheus/tasks/main.yml b/ansible/roles/prometheus/tasks/main.yml @@ -0,0 +1,40 @@ +--- + +- file: + name: "{{docker__volumes_location }}/prometheus" + state: "directory" + owner: "nobody" + group: "nogroup" + +- file: + name: "{{docker__volumes_location }}/grafana" + state: "directory" + owner: 472 + group: 472 + +- name: Prometheus container + docker_container: + name: "{{ prometheus__name }}" + image: prom/prometheus + state: started + restart_policy: always + pull: true + volumes: + - "{{ docker__volumes_location }}/prometheus:/prometheus" + +- name: Grafana container + docker_container: + name: "{{ grafana__name }}" + image: grafana/grafana + state: started + restart_policy: always + pull: true + volumes: + - "{{ docker__volumes_location }}/grafana:/var/lib/grafana" + ports: + - "{{ grafana__private_ip }}:{{ grafana__port }}:3000" + links: + - "prometheus:{{ prometheus__name }}" + env: + GF_SECURITY_ADMIN_USER="{{ grafana__admin_user }}" + GF_SECURITY_ADMIN_PASSWORD="{{ grafana__admin_password }}"