Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to install node exporter from local tar.gz file #68

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ prometheus_group: prometheus

prometheus_version: 1.5.0
prometheus_node_exporter_version: 0.13.0
prometheus_node_exporter_file: false
prometheus_alertmanager_version: 0.5.1

gosu_version: "1.10"
Expand Down
25 changes: 22 additions & 3 deletions tasks/install-node-exporter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
set_fact:
prometheus_node_exporter_subdir: "{{ prometheus_install_path }}/node_exporter-{{ prometheus_node_exporter_version }}.{{ prometheus_platform_suffix }}"


- name: set download url for versions >= 0.13.0
set_fact:
prometheus_node_exporter_tarball_url: "https://github.com/prometheus/node_exporter/releases/download/v{{ prometheus_node_exporter_version }}/node_exporter-{{ prometheus_node_exporter_version }}.{{ prometheus_platform_suffix }}.tar.gz"
Expand All @@ -38,9 +37,29 @@
src: "{{ prometheus_node_exporter_tarball_url }}"
dest: "{{ prometheus_install_path }}"
copy: no
creates : "{{ prometheus_node_exporter_daemon_dir }}/node_exporter"

when: prometheus_node_exporter_version != "git" and prometheus_node_exporter_file == false

- block:

- name: set tar.gz for file name
set_fact:
prometheus_node_exporter_tarball_filename: "node_exporter-{{ prometheus_node_exporter_version }}.{{ prometheus_platform_suffix }}.tar.gz"

when: prometheus_node_exporter_version != "git"
- name: set internal variables for convenience
set_fact:
prometheus_node_exporter_daemon_dir: "{{ prometheus_install_path }}/{{ (( prometheus_node_exporter_tarball_filename | splitext)[0] | splitext)[0] }}"

- name: untar node_exporter tarball
unarchive:
src: "files/prometheus/{{ prometheus_node_exporter_tarball_filename }}"
dest: "{{ prometheus_install_path }}"
copy: yes
owner: "{{ prometheus_user }}"
group: "{{ prometheus_group }}"

when: prometheus_node_exporter_file == true and prometheus_node_exporter_version != "git"

- block:

Expand Down Expand Up @@ -79,7 +98,7 @@
args:
creates: "{{ prometheus_install_path }}/node_exporter"

when: prometheus_node_exporter_version == "git"
when: prometheus_node_exporter_version == "git" and prometheus_node_exporter_file == false



Expand Down