Safeguard
Supply Chain•

How do you verify signed Ansible collections with a keyring?

Ansible can check detached GPG signatures when you install a collection. Setting the keyring, the required signature count and what verification skips.

Safeguard Security Team
3 min read

To verify a signed Ansible collection, provide a GnuPG keyring that holds the signer's public key and install from a server that supplies signatures. Ansible then checks detached signatures against the collection's MANIFEST.json before trusting it. Not every distribution server offers signatures.

How the check works

If a distribution server signs a collection, it provides ASCII armored, detached signatures. Ansible uses them to verify the authenticity of the MANIFEST.json, and that manifest is then used to verify the collection's contents. The documentation notes that this option is not available on all servers.

Install with verification

ansible-galaxy collection install my_namespace.my_collection --keyring ~/.ansible/pubring.kbx

You can skip the --keyring flag if you have configured a keyring for ansible-galaxy. You can also add your own signatures with --signature, given as URIs, or list them under a signatures key in requirements.yml.

How many signatures must pass

By default, verification succeeds if at least one signature verifies. You can raise the bar with --required-valid-signature-count, or the matching environment variable, and require all signatures with the value all. Prefix a value with +, as in +all or +1, to make verification fail when no valid signature is found at all.

Limits to know

CaseIs GnuPG verification applied
Install from a distribution serverYes
Install from a Git repositoryNo
Install from a source directoryNo
Install from a tar.gz file or URLNo

The documentation states that user provided signatures are not used for collections installed from Git repositories, source directories or tar.gz paths. If your pipeline installs that way, signature verification does not protect those installs.

A rollout plan

  1. Decide which publishers you trust and import their public keys into a dedicated keyring.
  2. Set ANSIBLE_GALAXY_GPG_KEYRING in the pipeline environment.
  3. Set the required valid signature count to a value you can defend, and use a + prefix if unsigned content must fail.
  4. Pin versions in requirements.yml.
  5. Run ansible-galaxy collection verify with the keyring after install.

What a signature does and does not tell you

A valid signature says the content matches what the key holder published. It does not say the content is free of defects. Keep reading release notes and diffs for versions you adopt.

Quick check

Do all Galaxy servers support signing?

No. The documentation says signing is not available on all distribution servers.

What if I do not have the signer's key?

Verification can fail with a missing public key error. The documentation describes options for handling specific GnuPG status codes, so decide this deliberately.

Are Git installs checked?

Not by the GnuPG verification described here.

Safeguard offers SBOM and dependency scanning and policy gates that can block a pull request on findings, and you can try a free scan at gold.safeguard.sh/scan.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.