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