aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.ansible/roles
diff options
context:
space:
mode:
authorpmikus <pmikus@cisco.com>2021-07-28 10:44:43 +0000
committerPeter Mikus <pmikus@cisco.com>2021-07-28 11:00:55 +0000
commit8843893ca7531cbb2212a5ed79882909c8374381 (patch)
treee99fdf71c923fff39c4b20b8b69263993f4b3972 /fdio.infra.ansible/roles
parentcf63723c2758fb5561bd1810a2725b1e187f9c1f (diff)
Infra: upgrade monitoring solution
+ bump versions - remove cadvisor Signed-off-by: pmikus <pmikus@cisco.com> Change-Id: I3de95531f1b09f7254152254e92f225dde653e45
Diffstat (limited to 'fdio.infra.ansible/roles')
-rw-r--r--fdio.infra.ansible/roles/prometheus_exporter/defaults/main.yaml32
-rw-r--r--fdio.infra.ansible/roles/prometheus_exporter/handlers/main.yaml16
-rw-r--r--fdio.infra.ansible/roles/prometheus_exporter/tasks/main.yaml69
-rw-r--r--fdio.infra.ansible/roles/prometheus_exporter/tasks/ubuntu_bionic.yaml33
-rw-r--r--fdio.infra.ansible/roles/prometheus_exporter/tasks/ubuntu_focal.yaml33
5 files changed, 86 insertions, 97 deletions
diff --git a/fdio.infra.ansible/roles/prometheus_exporter/defaults/main.yaml b/fdio.infra.ansible/roles/prometheus_exporter/defaults/main.yaml
index eb2b94cb26..e97ad2b0c7 100644
--- a/fdio.infra.ansible/roles/prometheus_exporter/defaults/main.yaml
+++ b/fdio.infra.ansible/roles/prometheus_exporter/defaults/main.yaml
@@ -2,16 +2,30 @@
# file: roles/prometheus_exporter/defaults/main.yaml
# Inst - Exporters.
-ne_packages: "{{ ne_packages_by_distro[ansible_distribution | lower][ansible_machine] }}"
+packages: "{{ packages_base + packages_by_distro[ansible_distribution | lower] + packages_by_arch[ansible_machine] }}"
-ne_packages_by_distro:
+packages_base:
+ - []
+
+packages_by_distro:
ubuntu:
- aarch64: "http://ports.ubuntu.com/pool/universe/p/prometheus-node-exporter/prometheus-node-exporter_1.0.1+ds-1_arm64.deb"
- x86_64: "http://archive.ubuntu.com/ubuntu/pool/universe/p/prometheus-node-exporter/prometheus-node-exporter_1.0.1+ds-1_amd64.deb"
+ - "python3-docker"
+ - "python3-dockerpty"
-be_packages: "{{ be_packages_by_distro[ansible_distribution | lower][ansible_machine] }}"
+packages_by_arch:
+ aarch64:
+ - []
+ x86_64:
+ - []
-be_packages_by_distro:
- ubuntu:
- aarch64: "http://ports.ubuntu.com/pool/universe/p/prometheus-blackbox-exporter/prometheus-blackbox-exporter_0.17.0+ds-1_arm64.deb"
- x86_64: "http://archive.ubuntu.com/ubuntu/pool/universe/p/prometheus-blackbox-exporter/prometheus-blackbox-exporter_0.17.0+ds-1_amd64.deb"
+ne_image: "{{ ne_image_by_arch[ansible_machine] }}"
+
+ne_image_by_arch:
+ aarch64: "prom/node-exporter:v1.2.0"
+ x86_64: "prom/node-exporter:v1.2.0"
+
+be_image: "{{ be_image_by_arch[ansible_machine] }}"
+
+be_image_by_arch:
+ aarch64: "prom/blackbox-exporter:v0.19.0"
+ x86_64: "prom/blackbox-exporter:v0.19.0"
diff --git a/fdio.infra.ansible/roles/prometheus_exporter/handlers/main.yaml b/fdio.infra.ansible/roles/prometheus_exporter/handlers/main.yaml
deleted file mode 100644
index 9c374eaa61..0000000000
--- a/fdio.infra.ansible/roles/prometheus_exporter/handlers/main.yaml
+++ /dev/null
@@ -1,16 +0,0 @@
----
-# file roles/prometheus_exporter/handlers/main.yaml
-
-- name: Restart Prometheus Node Exporter
- systemd:
- daemon_reload: true
- enabled: true
- name: "prometheus-node-exporter"
- state: "restarted"
-
-- name: Restart Prometheus Blackbox Exporter
- systemd:
- daemon_reload: true
- enabled: true
- name: "prometheus-blackbox-exporter"
- state: "restarted" \ No newline at end of file
diff --git a/fdio.infra.ansible/roles/prometheus_exporter/tasks/main.yaml b/fdio.infra.ansible/roles/prometheus_exporter/tasks/main.yaml
index b38215c4a2..3f4b563352 100644
--- a/fdio.infra.ansible/roles/prometheus_exporter/tasks/main.yaml
+++ b/fdio.infra.ansible/roles/prometheus_exporter/tasks/main.yaml
@@ -1,15 +1,72 @@
---
# file: roles/prometheus_exporter/tasks/main.yaml
-- include_tasks: "{{ ansible_distribution|lower }}_{{ ansible_distribution_release }}.yaml"
+- name: Inst - Update Package Cache (APT)
+ apt:
+ update_cache: yes
+ cache_valid_time: 3600
+ when:
+ - ansible_distribution|lower == 'ubuntu'
tags:
- prometheus-inst
+- name: Inst - Prerequisites
+ package:
+ name: "{{ packages | flatten(levels=1) }}"
+ state: latest
+ tags:
+ - prometheus-inst
+
+- name: Inst - Start a NodeExporter container
+ docker_container:
+ name: "NodeExporter"
+ image: "{{ ne_image }}"
+ state: "started"
+ restart_policy: "unless-stopped"
+ detach: yes
+ ports:
+ - "9100:9100"
+ privileged: yes
+ command:
+ - "--path.procfs=/host/proc"
+ - "--path.rootfs=/rootfs"
+ - "--path.sysfs=/host/sys"
+ - "--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)"
+ volumes:
+ - "/:/rootfs:ro"
+ - "/proc:/host/proc:ro"
+ - "/sys:/host/sys:ro"
+ tags:
+ - prometheus-inst
+
+- name: Inst - Create a Config Directory
+ ansible.builtin.file:
+ path: "/etc/prometheus/"
+ state: "directory"
+ mode: "0755"
+ tags:
+ - prometheus-conf-blackbox-exporter
+
- name: Conf - Prometheus Blackbox Exporter
copy:
- src: 'files/blackbox.yml'
- dest: '/etc/prometheus/blackbox.yml'
- notify:
- - "Restart Prometheus Blackbox Exporter"
+ src: "files/blackbox.yml"
+ dest: "/etc/prometheus/blackbox.yml"
+ tags:
+ - prometheus-conf-blackbox-exporter
+
+- name: Inst - Start a BlackBoxExporter container
+ docker_container:
+ name: "BlackBoxExporter"
+ image: "{{ be_image }}"
+ state: "started"
+ restart_policy: "unless-stopped"
+ detach: yes
+ ports:
+ - "9115:9115"
+ privileged: yes
+ command:
+ - "--config.file=/config/blackbox.yml"
+ volumes:
+ - "/etc/prometheus/blackbox.yml:/config/blackbox.yml:ro"
tags:
- - prometheus-conf-blackbox-exporter \ No newline at end of file
+ - prometheus-inst \ No newline at end of file
diff --git a/fdio.infra.ansible/roles/prometheus_exporter/tasks/ubuntu_bionic.yaml b/fdio.infra.ansible/roles/prometheus_exporter/tasks/ubuntu_bionic.yaml
deleted file mode 100644
index 566753e272..0000000000
--- a/fdio.infra.ansible/roles/prometheus_exporter/tasks/ubuntu_bionic.yaml
+++ /dev/null
@@ -1,33 +0,0 @@
----
-# file: roles/prometheus_exporter/tasks/ubuntu_bionic.yaml
-
-- name: Inst - Update Package Cache (APT)
- apt:
- update_cache: yes
- cache_valid_time: 3600
- tags:
- - prometheus-inst-prerequisites
-
-- name: Inst - Prerequisites
- package:
- name: "init-system-helpers"
- default_release: "bionic-backports"
- state: latest
- tags:
- - prometheus-inst-prerequisites
-
-- name: Inst - Prometheus Node Exporter
- apt:
- deb: "{{ ne_packages }}"
- notify:
- - "Restart Prometheus Node Exporter"
- tags:
- - prometheus-inst-node-exporter
-
-- name: Inst - Prometheus Blackbox Exporter
- apt:
- deb: "{{ be_packages }}"
- notify:
- - "Restart Prometheus Blackbox Exporter"
- tags:
- - prometheus-inst-blackbox-exporter \ No newline at end of file
diff --git a/fdio.infra.ansible/roles/prometheus_exporter/tasks/ubuntu_focal.yaml b/fdio.infra.ansible/roles/prometheus_exporter/tasks/ubuntu_focal.yaml
deleted file mode 100644
index 3d7064355e..0000000000
--- a/fdio.infra.ansible/roles/prometheus_exporter/tasks/ubuntu_focal.yaml
+++ /dev/null
@@ -1,33 +0,0 @@
----
-# file: roles/prometheus_exporter/tasks/ubuntu_focal.yaml
-
-- name: Inst - Update Package Cache (APT)
- apt:
- update_cache: yes
- cache_valid_time: 3600
- tags:
- - prometheus-inst-prerequisites
-
-- name: Inst - Prerequisites
- package:
- name: "init-system-helpers"
- default_release: "focal-backports"
- state: latest
- tags:
- - prometheus-inst-prerequisites
-
-- name: Inst - Prometheus Node Exporter
- apt:
- deb: "{{ ne_packages }}"
- notify:
- - "Restart Prometheus Node Exporter"
- tags:
- - prometheus-inst-node-exporter
-
-- name: Inst - Prometheus Blackbox Exporter
- apt:
- deb: "{{ be_packages }}"
- notify:
- - "Restart Prometheus Blackbox Exporter"
- tags:
- - prometheus-inst-blackbox-exporter \ No newline at end of file