Skip to content

Vault variables not expanded under scrape config #691

@AlistairMaccallum

Description

@AlistairMaccallum

When using encrypted vault variables in the prometheus_scrape_configs variables they do not populate to the decrypted vars they use the vault string instead.

e.g

# host vars

prometheus_scrape_configs:
  - job_name: test
    basic_auth:
      username: admin
      password: "{{ vault_encrypted_pass }}"
    static_configs:
      - targets:
          - target1

Even when "pre-decrypting" the var into another var the same thing happens

# host vars

prometheus_scrape_configs:
  - job_name: test
    basic_auth:
      username: admin
      password: "{{ plain_pass }}"
    static_configs:
      - targets:
          - target1

plain_pass: "{{ vault_encrypted_pass }}"

Ansible version

ansible [core 2.20.0]
  python version = 3.12.3 (main, Nov  6 2025, 13:44:16) [GCC 13.3.0]
  jinja version = 3.1.6
  pyyaml version = 6.0.3 (with libyaml v0.2.5)

prometheus.prometheus                    0.27.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions