From 32c11fb3cd2d95810016c51db9b80ce6227fb0c9 Mon Sep 17 00:00:00 2001 From: Arsalan Sefidgar Date: Wed, 10 Jan 2024 14:03:57 +0330 Subject: [PATCH] feat: add basic auth to the node exporter --- node-exporter/node-exporter/config.yml | 3 +++ node-exporter/tasks/main.yml | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 node-exporter/node-exporter/config.yml diff --git a/node-exporter/node-exporter/config.yml b/node-exporter/node-exporter/config.yml new file mode 100644 index 0000000..c3e39f6 --- /dev/null +++ b/node-exporter/node-exporter/config.yml @@ -0,0 +1,3 @@ +# echo 1234 | htpasswd -inBC 10 "" | tr -d ':\n' +basic_auth_users: + admin: $2y$10$DflJBSLBlS2z3d9rk6pdk.EadVxBVlXc084wPgCqoaW2T1KblOjyi diff --git a/node-exporter/tasks/main.yml b/node-exporter/tasks/main.yml index 922cfde..5113da4 100644 --- a/node-exporter/tasks/main.yml +++ b/node-exporter/tasks/main.yml @@ -1,3 +1,17 @@ +- name: Services directory + ansible.builtin.file: + path: /root/services/ + state: directory + mode: '744' + +- name: Copy node-exporter + ansible.builtin.copy: + src: node-exporter + dest: /root/services/ + owner: root + group: root + mode: '744' + - name: Install node-exporter community.docker.docker_container: name: node-exporter @@ -13,8 +27,10 @@ - "/proc:/host/proc:ro" - "/sys:/host/sys:ro" - "/:/rootfs:ro" + - "/root/services/node-exporter/config.yml:/etc/node_exporter/config.yml" command: - '--path.procfs=/host/proc' - '--path.rootfs=/rootfs' - '--path.sysfs=/host/sys' - '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)' + - '--web.config=/etc/node_exporter/config.yml'