diff --git a/roles/prometheus/defaults/main.yml b/roles/prometheus/defaults/main.yml index 04c2f2be2..a1f5d971e 100644 --- a/roles/prometheus/defaults/main.yml +++ b/roles/prometheus/defaults/main.yml @@ -66,7 +66,7 @@ prometheus_remote_read: [] # password: FOO prometheus_external_labels: - environment: "{{ ansible_fqdn | default(ansible_host) | default(inventory_hostname) }}" + environment: "{{ ansible_facts['fqdn'] | default(ansible_host) | default(inventory_hostname) }}" prometheus_targets: {} # node: @@ -80,7 +80,7 @@ prometheus_scrape_configs: metrics_path: "{{ prometheus_metrics_path }}" static_configs: - targets: - - "{{ ansible_fqdn | default(ansible_host) | default('localhost') }}:9090" + - "{{ ansible_facts['fqdn'] | default(ansible_host) | default('localhost') }}:9090" - job_name: "node" file_sd_configs: - files: diff --git a/roles/prometheus/meta/argument_specs.yml b/roles/prometheus/meta/argument_specs.yml index 3b168ece4..6ec43e83e 100644 --- a/roles/prometheus/meta/argument_specs.yml +++ b/roles/prometheus/meta/argument_specs.yml @@ -100,7 +100,7 @@ argument_specs: description: "Provide map of additional labels which will be added to any time series or alerts when communicating with external systems" type: "dict" default: - environment: "{{ ansible_fqdn | default(ansible_host) | default(inventory_hostname) }}" + environment: "{{ ansible_facts['fqdn'] | default(ansible_host) | default(inventory_hostname) }}" prometheus_targets: description: - "Targets which will be scraped." @@ -115,7 +115,7 @@ argument_specs: metrics_path: "{{ prometheus_metrics_path }}" static_configs: - targets: - - "{{ ansible_fqdn | default(ansible_host) | default('localhost') }}:9090" + - "{{ ansible_facts['fqdn'] | default(ansible_host) | default('localhost') }}:9090" - job_name: "node" file_sd_configs: - files: diff --git a/roles/prometheus/molecule/alternative/molecule.yml b/roles/prometheus/molecule/alternative/molecule.yml index dc9d00e88..82b96020c 100644 --- a/roles/prometheus/molecule/alternative/molecule.yml +++ b/roles/prometheus/molecule/alternative/molecule.yml @@ -63,7 +63,7 @@ provisioner: metrics_path: "{{ prometheus_metrics_path }}" static_configs: - targets: - - "{{ ansible_fqdn | default(ansible_host) | default('localhost')\ + - "{{ ansible_facts['fqdn'] | default(ansible_host) | default('localhost')\ \ }}:9090" - job_name: "node" file_sd_configs: