From 8d6136a906088f86803fc9b21811efcb41ee27c8 Mon Sep 17 00:00:00 2001 From: ken miles Date: Tue, 31 May 2022 12:43:27 +1000 Subject: [PATCH 1/3] Allow for remote download --- defaults/main.yml | 1 + tasks/main.yml | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) 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..7427d88 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -6,9 +6,17 @@ 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: "/tmp/{{ 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}}" From 4b5217c1f2f43e96661956dce8e1497c3448dc0a Mon Sep 17 00:00:00 2001 From: ken miles Date: Tue, 31 May 2022 13:15:56 +1000 Subject: [PATCH 2/3] Whoops --- tasks/main.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tasks/main.yml b/tasks/main.yml index 7427d88..08df1bb 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -12,7 +12,7 @@ become: no get_url: url: "{{ url }}" - dest: "/tmp/{{ prometheus_node_exporter_release_name }}.tar.gz" + 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 @@ -22,6 +22,8 @@ owner: "{{ prometheus_exporters_common_user}}" group: "{{ prometheus_exporters_common_group }}" mode: '0755' + when: prometheus_node_exporter_local_download | bool + - name: unarchive binary tarball unarchive: From 80db26acb378a8d7fb966fa8d63c899e90f005a9 Mon Sep 17 00:00:00 2001 From: ken miles Date: Tue, 31 May 2022 13:21:38 +1000 Subject: [PATCH 3/3] Formatting --- tasks/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/tasks/main.yml b/tasks/main.yml index 08df1bb..5087987 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -24,7 +24,6 @@ mode: '0755' when: prometheus_node_exporter_local_download | bool - - name: unarchive binary tarball unarchive: copy: no