Files
cobald-testenv/roles/cobald/tasks/grafana.yml

55 lines
1.4 KiB
YAML

- name: create influx token for grafana
influx_token:
base: "http://localhost:{{influx_pubport}}"
org: "my-org"
auth_token: "{{influx_admin_token}}"
description: grafana read access
key: grafana
permissions:
- action: read
resource:
type: buckets
register: influx_grafana_token
- name: run grafana
docker_container:
name: ed-grafana
image: docker.io/grafana/grafana:7.5.7
hostname: ed-grafana
domainname: cobald.local
networks:
- name: "{{cobald_docker_network}}"
networks_cli_compatible: True
published_ports:
- "3000:3000"
state: started
detach: True
cleanup: True
- wait_for:
host: localhost
port: 3000
- community.grafana.grafana_datasource:
grafana_url: http://localhost:3000
grafana_user: admin
grafana_password: admin
name: InfluxDB
ds_type: influxdb
ds_url: "{{influx_url}}"
additional_json_data:
defaultBucket: "{{influx_bucket}}"
organization: "{{influx_org}}"
version: Flux
additional_secure_json_data:
token: "{{influx_grafana_token.token}}"
- community.grafana.grafana_dashboard:
grafana_url: http://localhost:3000
grafana_user: admin
grafana_password: admin
state: present
commit_message: updated by ansible
overwrite: yes
json_data: "{{lookup('file', 'grafana-dashboard.json')|from_json}}"