Skip to content

fix(prometheus): use ansible_facts for fqdn - #870

Merged
SuperQ merged 1 commit into
prometheus-community:mainfrom
willbuckner:fix/prometheus-injected-fqdn-fact
Aug 24, 2026
Merged

fix(prometheus): use ansible_facts for fqdn#870
SuperQ merged 1 commit into
prometheus-community:mainfrom
willbuckner:fix/prometheus-injected-fqdn-fact

Conversation

@willbuckner

Copy link
Copy Markdown
Contributor

Summary

  • Replace injected ansible_fqdn references with ansible_facts['fqdn'].
  • Update the Prometheus defaults and corresponding argument specifications.
  • Update the alternative Molecule scenario.
  • Preserve the existing ansible_host, inventory_hostname, and localhost fallbacks.

Motivation

This fixes a deprecation warning I was seeing on my own Ansible deployments. The default behavior of injecting facts as top-level variables is deprecated and will be removed in ansible-core 2.24.

Reading fqdn directly from ansible_facts avoids the deprecation warning and works when inject_facts_as_vars is disabled.

This is a follow-up to #845.

Validation

  • ansible-lint and yamllint passed with zero failures or warnings.
  • Verified with ansible-core 2.21.2 that the deprecation warning disappears.
  • git diff --check passed.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Docs Build 📝

Thank you for contributing!✨

This PR has been merged and the docs are now incorporated into main:
https://prometheus-community.github.io/ansible/branch/main

@SuperQ SuperQ left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@willbuckner

Copy link
Copy Markdown
Contributor Author

Any idea what's going on with this second set of integration test failures here?

  Aug 07 08:49:52 fed2fb714349 systemd[1]: Dependency failed for Docker Application Container Engine.
  Aug 07 08:49:52 fed2fb714349 systemd[1]: docker.service: Job docker.service/start failed with result 'dependency'.
  Setting up dnsmasq-base (2.90-0ubuntu0.20.04.1) ...
  Setting up ubuntu-fan (0.12.13ubuntu0.1) ...
  Created symlink /etc/systemd/system/multi-user.target.wants/ubuntu-fan.service → /lib/systemd/system/ubuntu-fan.service.
  Processing triggers for systemd (245.4-4ubuntu3.18) ...
  Processing triggers for libc-bin (2.31-0ubuntu9.9) ...
  Processing triggers for dbus (1.12.16-2ubuntu2.3) ...
  ERROR    Failed to validate /root/ansible_collections/prometheus/prometheus/roles/prometheus/molecule/alternative/molecule.yml
  

I'm investigating but it doesn't seem related to my change.

@willbuckner

Copy link
Copy Markdown
Contributor Author

CI failures diagnosis: #869 (comment)

Signed-off-by: Will Buckner <1458615+willbuckner@users.noreply.github.com>
@willbuckner
willbuckner force-pushed the fix/prometheus-injected-fqdn-fact branch from d7a2411 to b63c191 Compare August 24, 2026 07:47
@github-actions github-actions Bot added bugfix and removed bugfix labels Aug 24, 2026
@willbuckner

Copy link
Copy Markdown
Contributor Author

@SuperQ this one is rebased on top of your CI fixes and is ready to go as well :) Thanks!

@SuperQ
SuperQ merged commit 6f94dd0 into prometheus-community:main Aug 24, 2026
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants