From 4b74ca0d0f7eef1222a5f5efcab8dd00085c401e Mon Sep 17 00:00:00 2001 From: Alexander Dahl Date: Mon, 12 Dec 2022 21:22:03 +0100 Subject: [PATCH 1/4] :hammer: Move influxdb org to variable We will need that for deploying telegraf docker metrics container soon. --- group_vars/all/vars.yml | 3 +++ host-pottwal.yml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/group_vars/all/vars.yml b/group_vars/all/vars.yml index 3f3eba3..0dc8c27 100644 --- a/group_vars/all/vars.yml +++ b/group_vars/all/vars.yml @@ -57,3 +57,6 @@ users: # Data for DD24 dyndns updates dyndns_domain: "dyndns.n39.eu" dyndns_password: "{{ vault_dyndns_password }}" + +# Shared influxdb items +influxdb_org: "Netz39" diff --git a/host-pottwal.yml b/host-pottwal.yml index c648344..3e9558b 100644 --- a/host-pottwal.yml +++ b/host-pottwal.yml @@ -324,7 +324,7 @@ TZ: "{{ timezone }}" DOCKER_INFLUXDB_INIT_USERNAME: "{{ influxdb_init_username }}" DOCKER_INFLUXDB_INIT_PASSWORD: "{{ influxdb_init_password }}" - DOCKER_INFLUXDB_INIT_ORG: Netz39 + DOCKER_INFLUXDB_INIT_ORG: "{{ influxdb_org }}" DOCKER_INFLUXDB_INIT_BUCKET: default volumes: - "{{ data_dir }}/influxdb/data:/var/lib/influxdb2" From 57db3bf0caabafccbb03fa070ee38dc80eea3925 Mon Sep 17 00:00:00 2001 From: Alexander Dahl Date: Mon, 12 Dec 2022 21:36:47 +0100 Subject: [PATCH 2/4] :whale: Add telegraf container for Docker metrics in influxdb All our hosts running docker can put their metrics into our influxdb now. Note: not all docker hosts do this (yet), because the influxdb is currently only reachable from within the local space internal network in our rooms. Link: https://docs.ansible.com/ansible/latest/inventory_guide/intro_patterns.html Link: https://galaxy.ansible.com/lespocky/telegraf_docker_in_docker References: #760 --- group-docker_host.yml | 14 ++++++++++++++ group_vars/docker_host/vault | 11 +++++++++++ requirements.yml | 2 ++ 3 files changed, 27 insertions(+) create mode 100644 group_vars/docker_host/vault diff --git a/group-docker_host.yml b/group-docker_host.yml index 7a338c0..15c2ed9 100644 --- a/group-docker_host.yml +++ b/group-docker_host.yml @@ -4,3 +4,17 @@ roles: - role: docker_setup + +- hosts: docker_host:&location_space + become: true + + roles: + - role: lespocky.telegraf_docker_in_docker + vars: + tdid_conf_dir: "/etc/telegraf" + tdid_influxdb_org: "{{ influxdb_org }}" + tdid_influx_token: "{{ vault_tdid_influx_token }}" + tdid_docker_image: "telegraf:1.24-alpine" + tdid_influxdb_url: "https://influx.n39.eu" + tdid_influxdb_bucket: "system_metrics" + tdid_timezone: "{{ timezone }}" diff --git a/group_vars/docker_host/vault b/group_vars/docker_host/vault new file mode 100644 index 0000000..b343ddb --- /dev/null +++ b/group_vars/docker_host/vault @@ -0,0 +1,11 @@ +$ANSIBLE_VAULT;1.1;AES256 +32316530363561636236376162663963643966336566373964633066326365373234323365376635 +3032376339633462623762313638303066306637323630660a323839333935643761313534646631 +64303438376132303461363664653239373663323433343331363833373331666532303538306433 +3766633837323238320a383461616434326531613532323463393939333331306264663765393761 +35336332336135623834373661323535376264323564383234633435373363343739316234653631 +32336663636632386131316165663766643935633562353235633937666264326537323362633864 +32386264643539356430353837663761356561386162306466643838303462353631346564653432 +33356266666466333132636364643962383030313264336363356439663066346462653466343163 +38666537306464323434366135333433623335396239636461353136663563323934653737336337 +3664393331316162303938626330643137653232653263366461 diff --git a/requirements.yml b/requirements.yml index a733ef5..392bec7 100644 --- a/requirements.yml +++ b/requirements.yml @@ -10,6 +10,8 @@ roles: version: v1.0.0 - src: git+https://github.com/maz3max/ble-keykeeper-role.git version: v1.1.0 + - src: lespocky.telegraf_docker_in_docker + version: v0.2.0 collections: - name: community.grafana From 366ef720afe5ec49b2831c00c39aeeff4ea5eabb Mon Sep 17 00:00:00 2001 From: Alexander Dahl Date: Wed, 11 Jan 2023 18:26:33 +0100 Subject: [PATCH 3/4] :arrow_up: Bump role version to v0.2.1 Execution of the playbook failed like this before: TASK [lespocky.telegraf_docker_in_docker : Copy telegraf docker_input_agent conf] ************************************************************************************************ fatal: [unicorn.n39.eu]: FAILED! => changed=false checksum: 3230d394872351730e265778639936912c9f1030 msg: Destination directory /etc/telegraf does not exist fatal: [krypton.n39.eu]: FAILED! => changed=false checksum: 3230d394872351730e265778639936912c9f1030 msg: Destination directory /etc/telegraf does not exist fatal: [radon.n39.eu]: FAILED! => changed=false checksum: 3230d394872351730e265778639936912c9f1030 msg: Destination directory /etc/telegraf does not exist fatal: [pottwal.n39.eu]: FAILED! => changed=false checksum: 3230d394872351730e265778639936912c9f1030 msg: Destination directory /etc/telegraf does not exist That was a bug in the role, which was fixed with release v0.2.1. Link: https://github.com/LeSpocky/ansible-role-telegraf-docker-in-docker/issues/15 --- requirements.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.yml b/requirements.yml index 392bec7..7281888 100644 --- a/requirements.yml +++ b/requirements.yml @@ -11,7 +11,7 @@ roles: - src: git+https://github.com/maz3max/ble-keykeeper-role.git version: v1.1.0 - src: lespocky.telegraf_docker_in_docker - version: v0.2.0 + version: v0.2.1 collections: - name: community.grafana From f4c4a42edca797d0aabf2b8357bc48593cd84b48 Mon Sep 17 00:00:00 2001 From: Alexander Dahl Date: Wed, 11 Jan 2023 20:16:05 +0100 Subject: [PATCH 4/4] :wrench: Fix influxdb org Unsure why this differs from the previous value, but this is the organization name actually used by the running database. Output from the container: 2023-01-11T19:22:41Z E! [outputs.influxdb_v2] Failed to write metric to system_metrics (will be dropped: 404 Not Found): not found: organization name "Netz39" not found --- group_vars/all/vars.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/group_vars/all/vars.yml b/group_vars/all/vars.yml index 0dc8c27..ec293be 100644 --- a/group_vars/all/vars.yml +++ b/group_vars/all/vars.yml @@ -59,4 +59,4 @@ dyndns_domain: "dyndns.n39.eu" dyndns_password: "{{ vault_dyndns_password }}" # Shared influxdb items -influxdb_org: "Netz39" +influxdb_org: "netz39"