blob: 7c28ea89fea268c87a5e07fa7871f93e889f7c42 [file] [log] [blame]
---
# node_exporter tasks/main.yml
#
# SPDX-FileCopyrightText: © 2021 Open Networking Foundation <support@opennetworking.org>
# SPDX-License-Identifier: Apache-2.0
- name: include OS-specific vars
include_vars: "{{ ansible_os_family }}.yml"
- name: include OS-specific tasks
include_tasks: "{{ ansible_os_family }}.yml"
- name: Create group for Node Exporter
group:
name: "{{ node_exporter_name }}"
- name: Create user for Node Exporter
user:
name: "{{ node_exporter_name }}"
group: "{{ node_exporter_group }}"
comment: "{{ node_exporter_comment }}"
shell: "{{ node_exporter_shell }}"
system: true
password_lock: true
- name: Create Node Exporter dist dir
file:
path: "{{ node_exporter_dist_dir }}"
state: directory
owner: "root"
group: "root"
mode: "0755"
- name: Download Node Exporter distro .tgz file
get_url:
url: "https://github.com/prometheus/node_exporter/releases/download/\
v{{ node_exporter_ver }}/node_exporter-{{ node_exporter_ver }}.linux-amd64.tar.gz"
dest: "{{ node_exporter_dist_dir }}/node_exporter-{{ node_exporter_ver }}.tar.gz"
owner: "root"
group: "root"
mode: "0644"
checksum: "{{ node_exporter_checksum }}"
- name: Unarchive Node Exporter distribution
unarchive:
remote_src: true
src: "{{ node_exporter_dist_dir }}/node_exporter-{{ node_exporter_ver }}.tar.gz"
dest: "{{ node_exporter_dist_dir }}"
owner: "root"
group: "root"
creates: "{{ node_exporter_dist_dir }}/node_exporter-{{ node_exporter_ver }}.linux-amd64"
- name: Link Node Exporter distro to working dir
file:
state: "link"
src: "{{ node_exporter_dist_dir }}/node_exporter-{{ node_exporter_ver }}.linux-amd64"
dest: "{{ node_exporter_working_dir }}"
notify:
- "start-node-exporter"