fixed influxdb when container absent and wait_for
This commit is contained in:
@@ -1,17 +1,6 @@
|
||||
#- 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
|
||||
- name: run influxdb in docker container
|
||||
docker_container:
|
||||
name: ed-influxdb
|
||||
image: influxdb
|
||||
hostname: "{{influx_hostname}}"
|
||||
domainname: "{{influx_domainname}}"
|
||||
@@ -20,7 +9,8 @@
|
||||
published_ports:
|
||||
- "{{influx_pubport}}:8086"
|
||||
volumes:
|
||||
- "ed-influxdb-data-2:/var/lib/influxdb2" # -2 FIXME
|
||||
- "ed-influxdb-data:/var/lib/influxdb2"
|
||||
- "ed-influxdb-config:/etc/influxdb2"
|
||||
- "/container/volumes/influxdb-backup/:/backup"
|
||||
env:
|
||||
DOCKER_INFLUXDB_INIT_MODE: setup
|
||||
@@ -34,39 +24,44 @@
|
||||
networks_cli_compatible: True
|
||||
|
||||
- add_host:
|
||||
name: ed-influxdb-2
|
||||
name: ed-influxdb
|
||||
ansible_connection: docker
|
||||
# ansible_docker_extra_args: "-H=ssh://ed-c7-1.virt.magni.thoto.net" # FIXME
|
||||
ansible_docker_extra_args: "-H=ssh://{{ansible_host}}" # FIXME
|
||||
changed_when: False
|
||||
|
||||
- wait_for: # FIXME: does not work right -> fetch token fails
|
||||
port: "{{influx_pubport}}"
|
||||
- name: wait for influx to run
|
||||
raw: until curl http://localhost:8086 ; do sleep 1 ; done
|
||||
changed_when: False
|
||||
delegate_to: ed-influxdb
|
||||
|
||||
- name: "fetch auth token"
|
||||
- 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
|
||||
delegate_to: ed-influxdb
|
||||
|
||||
- set_fact:
|
||||
- name: set admin token
|
||||
set_fact:
|
||||
influx_admin_token:
|
||||
"{{(influx_token_fetch.stdout | from_json | first).token}}"
|
||||
|
||||
- influx_bucket:
|
||||
- name: create bucket for cobald
|
||||
influx_bucket:
|
||||
base: "http://localhost:{{influx_pubport}}"
|
||||
org: "my-org"
|
||||
auth_token: "{{influx_admin_token}}"
|
||||
name: "{{influx_bucket}}"
|
||||
|
||||
- name: "create dashboard"
|
||||
- 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:
|
||||
- name: create token for telegraf
|
||||
influx_token:
|
||||
base: "http://localhost:{{influx_pubport}}"
|
||||
org: "my-org"
|
||||
auth_token: "{{influx_admin_token}}"
|
||||
|
Reference in New Issue
Block a user