diff --git a/roles/node_exporter/defaults/main.yml b/roles/node_exporter/defaults/main.yml index 70cb27ef5..07a962880 100644 --- a/roles/node_exporter/defaults/main.yml +++ b/roles/node_exporter/defaults/main.yml @@ -1,7 +1,7 @@ --- node_exporter_version: 1.8.2 node_exporter_binary_url: "https://github.com/{{ _node_exporter_repo }}/releases/download/v{{ node_exporter_version }}/\ - node_exporter-{{ node_exporter_version }}.{{ ansible_system | lower }}-{{ _node_exporter_go_ansible_arch }}.tar.gz" + node_exporter-{{ node_exporter_version }}.{{ ansible_facts['system'] | lower }}-{{ _node_exporter_go_ansible_arch }}.tar.gz" node_exporter_checksums_url: "https://github.com/{{ _node_exporter_repo }}/releases/download/v{{ node_exporter_version }}/sha256sums.txt" node_exporter_web_disable_exporter_metrics: false @@ -32,4 +32,4 @@ node_exporter_system_user: "{{ node_exporter_system_group }}" node_exporter_config_dir: "/etc/node_exporter" # Local path to stash the archive and its extraction -node_exporter_local_cache_path: "/tmp/node_exporter-{{ ansible_system | lower }}-{{ _node_exporter_go_ansible_arch }}/{{ node_exporter_version }}" +node_exporter_local_cache_path: "/tmp/node_exporter-{{ ansible_facts['system'] | lower }}-{{ _node_exporter_go_ansible_arch }}/{{ node_exporter_version }}" diff --git a/roles/node_exporter/meta/argument_specs.yml b/roles/node_exporter/meta/argument_specs.yml index 05aa16e31..8f3c2708b 100644 --- a/roles/node_exporter/meta/argument_specs.yml +++ b/roles/node_exporter/meta/argument_specs.yml @@ -13,7 +13,7 @@ argument_specs: default: "1.8.2" node_exporter_binary_url: description: "URL of the node exporter binaries .tar.gz file" - default: "https://github.com/{{ _node_exporter_repo }}/releases/download/v{{ node_exporter_version }}/node_exporter-{{ node_exporter_version }}.{{ ansible_system | lower }}-{{ _node_exporter_go_ansible_arch }}.tar.gz" + default: "https://github.com/{{ _node_exporter_repo }}/releases/download/v{{ node_exporter_version }}/node_exporter-{{ node_exporter_version }}.{{ ansible_facts['system'] | lower }}-{{ _node_exporter_go_ansible_arch }}.tar.gz" node_exporter_checksums_url: description: "URL of the node exporter checksums file" default: "https://github.com/{{ _node_exporter_repo }}/releases/download/v{{ node_exporter_version }}/sha256sums.txt" @@ -78,7 +78,7 @@ argument_specs: default: "node-exp" node_exporter_local_cache_path: description: "Local path to stash the archive and its extraction" - default: "/tmp/node_exporter-{{ ansible_system | lower }}-{{ _node_exporter_go_ansible_arch }}/{{ node_exporter_version }}" + default: "/tmp/node_exporter-{{ ansible_facts['system'] | lower }}-{{ _node_exporter_go_ansible_arch }}/{{ node_exporter_version }}" node_exporter_config_dir: description: "Path to directory with node_exporter configuration" default: "/etc/node_exporter" diff --git a/roles/node_exporter/tasks/main.yml b/roles/node_exporter/tasks/main.yml index d41d4370a..4b80028f4 100644 --- a/roles/node_exporter/tasks/main.yml +++ b/roles/node_exporter/tasks/main.yml @@ -30,7 +30,7 @@ tasks_from: selinux.yml vars: _common_selinux_port: "{{ node_exporter_web_listen_address | urlsplit('port') }}" - when: ansible_selinux.status == "enabled" + when: ansible_facts['selinux'].status == "enabled" tags: - node_exporter_configure diff --git a/roles/node_exporter/templates/node_exporter.service.j2 b/roles/node_exporter/templates/node_exporter.service.j2 index 60cd69c6b..51e2afbc3 100644 --- a/roles/node_exporter/templates/node_exporter.service.j2 +++ b/roles/node_exporter/templates/node_exporter.service.j2 @@ -51,7 +51,7 @@ RestartSec=1 StartLimitInterval=0 {% set ns = namespace(protect_home = 'yes') %} -{% for m in ansible_mounts if m.mount.startswith('/home') %} +{% for m in ansible_facts['mounts'] if m.mount.startswith('/home') %} {% set ns.protect_home = 'read-only' %} {% endfor %} {% if node_exporter_textfile_dir.startswith('/home') %} diff --git a/roles/node_exporter/vars/main.yml b/roles/node_exporter/vars/main.yml index ad36964d9..faee8df17 100644 --- a/roles/node_exporter/vars/main.yml +++ b/roles/node_exporter/vars/main.yml @@ -3,7 +3,7 @@ _node_exporter_go_ansible_arch: "{{ {'i386': '386', 'x86_64': 'amd64', 'aarch64': 'arm64', 'armv7l': 'armv7', - 'armv6l': 'armv6'}.get(ansible_architecture, ansible_architecture) }}" + 'armv6l': 'armv6'}.get(ansible_facts['architecture'], ansible_facts['architecture']) }}" _node_exporter_repo: "prometheus/node_exporter" _github_api_headers: "{{ {'GITHUB_TOKEN': lookup('ansible.builtin.env', 'GITHUB_TOKEN')} if (lookup('ansible.builtin.env', 'GITHUB_TOKEN')) else {} }}" _node_exporter_binaries: ['node_exporter']