diff --git a/defaults/main.yml b/defaults/main.yml index 00eb894e..3d782d7b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -13,3 +13,5 @@ node_exporter_enabled_collectors: # ignored-fs-types: "^(sys|proc|auto)fs$" node_exporter_disabled_collectors: [] + +node_exporter_delegation: localhost diff --git a/tasks/install.yml b/tasks/install.yml index c4294b0a..7ac205c3 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -31,7 +31,7 @@ until: _download_binary is succeeded retries: 5 delay: 2 - delegate_to: localhost + delegate_to: "{{ node_exporter_delegation | default(inventory_hostname) }}" check_mode: false - name: Unpack node_exporter binary @@ -40,7 +40,7 @@ src: "/tmp/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}.tar.gz" dest: "/tmp" creates: "/tmp/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}/node_exporter" - delegate_to: localhost + delegate_to: "{{ node_exporter_delegation | default(inventory_hostname) }}" check_mode: false - name: Create /usr/local/bin