diff options
Diffstat (limited to 'fdio.infra.ansible/roles/prometheus_exporter/tasks')
3 files changed, 63 insertions, 72 deletions
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 |