80 lines
2.2 KiB
YAML
80 lines
2.2 KiB
YAML
#- file:
|
|
# path: "/container/volumes/influxdb-backup/"
|
|
# state: directory
|
|
# owner: "{{unpriv_user}}"
|
|
# group: docker
|
|
|
|
#- copy:
|
|
# src: influxdb-dashboard-cobald.json
|
|
# dest: /container/volumes/influxdb-backup/dash-cobald.json
|
|
# owner: "{{unpriv_user}}"
|
|
# group: docker
|
|
|
|
- docker_container:
|
|
name: ed-influxdb-2 # -2 FIXME
|
|
image: influxdb
|
|
hostname: "{{influx_hostname}}"
|
|
domainname: "{{influx_domainname}}"
|
|
networks:
|
|
- name: "{{ docker_network }}"
|
|
published_ports:
|
|
- "{{influx_pubport}}:8086"
|
|
volumes:
|
|
- "ed-influxdb-data-2:/var/lib/influxdb2" # -2 FIXME
|
|
- "/container/volumes/influxdb-backup/:/backup"
|
|
env:
|
|
DOCKER_INFLUXDB_INIT_MODE: setup
|
|
DOCKER_INFLUXDB_INIT_USERNAME: "{{influx_admin_user}}"
|
|
DOCKER_INFLUXDB_INIT_PASSWORD: "{{influx_admin_pw}}"
|
|
DOCKER_INFLUXDB_INIT_ORG: "{{influx_org}}"
|
|
DOCKER_INFLUXDB_INIT_BUCKET: my-bucket
|
|
state: started
|
|
detach: True
|
|
cleanup: True
|
|
networks_cli_compatible: True
|
|
|
|
- add_host:
|
|
name: ed-influxdb-2
|
|
ansible_connection: docker
|
|
ansible_docker_extra_args: "-H=ssh://ed-c7-1.virt.magni.thoto.net" # FIXME
|
|
changed_when: False
|
|
|
|
- wait_for: # FIXME: does not work right -> fetch token fails
|
|
port: "{{influx_pubport}}"
|
|
|
|
- name: "fetch auth token"
|
|
raw: influx auth list --user my-user --hide-headers --json
|
|
register: influx_token_fetch
|
|
changed_when: False
|
|
delegate_to: ed-influxdb-2
|
|
|
|
- set_fact:
|
|
influx_admin_token:
|
|
"{{(influx_token_fetch.stdout | from_json | first).token}}"
|
|
|
|
- influx_bucket:
|
|
base: "http://localhost:{{influx_pubport}}"
|
|
org: "my-org"
|
|
auth_token: "{{influx_admin_token}}"
|
|
name: "{{influx_bucket}}"
|
|
|
|
- name: "create dashboard"
|
|
influx_dashboard:
|
|
base: "http://localhost:{{influx_pubport}}"
|
|
org: "my-org"
|
|
auth_token: "{{influx_admin_token}}"
|
|
data: "{{lookup('file', 'influxdb-dashboard-cobald.json')}}"
|
|
|
|
- influx_token:
|
|
base: "http://localhost:{{influx_pubport}}"
|
|
org: "my-org"
|
|
auth_token: "{{influx_admin_token}}"
|
|
description: cobald tardis telegraf monitoring plugin
|
|
key: telegraf_cobaldtardis
|
|
permissions:
|
|
- action: write
|
|
resource:
|
|
type: buckets
|
|
name: "{{influx_bucket}}"
|
|
register: influx_telegraf_token
|