diff --git a/defaults/main.yml b/defaults/main.yml index 0c5085d..cb2b7ff 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,6 +1,7 @@ --- # minimum supported version: 0.15 +prometheus_node_exporter_local_download: true prometheus_node_exporter_version: 0.18.1 prometheus_node_exporter_release_name: "node_exporter-{{ prometheus_node_exporter_version }}.linux-{{ go_arch }}" diff --git a/tasks/main.yml b/tasks/main.yml index 343613a..5087987 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -6,14 +6,23 @@ module: get_url url: "{{ url }}" dest: "/tmp/{{ prometheus_node_exporter_release_name }}.tar.gz" - + when: prometheus_node_exporter_local_download | bool + +- name: download prometheus node exporter binary remotely + become: no + get_url: + url: "{{ url }}" + dest: "{{ prometheus_exporters_common_dist_dir }}/{{ prometheus_node_exporter_release_name }}.tar.gz" + when: not prometheus_node_exporter_local_download + - name: transfer local node exporter binary - copy: + copy: src: "/tmp/{{ prometheus_node_exporter_release_name }}.tar.gz" dest: "{{ prometheus_exporters_common_dist_dir }}/{{ prometheus_node_exporter_release_name }}.tar.gz" owner: "{{ prometheus_exporters_common_user}}" group: "{{ prometheus_exporters_common_group }}" mode: '0755' + when: prometheus_node_exporter_local_download | bool - name: unarchive binary tarball unarchive: