Skip to content

Add new PURL type: 'ansible' - #854

Open
anweshadas wants to merge 4 commits into
package-url:mainfrom
anweshadas:ansible
Open

Add new PURL type: 'ansible'#854
anweshadas wants to merge 4 commits into
package-url:mainfrom
anweshadas:ansible

Conversation

@anweshadas

@anweshadas anweshadas commented Apr 6, 2026

Copy link
Copy Markdown

Fixes #853 add new PURL type ansible for identifying Ansible collections.

Ansible collections can be installed from multiple sources:

  • Ansible Galaxy (default)
  • Red Hat Automation Hub
  • Git repositories
  • Direct URLs/tarballs
  • System packages (RPM/deb)

This type definition enables scanners to generate accurate PURLs for Ansible collections in SBOMs and vulnerability databases.

Qualifiers:

  • repository_url: Alternative Galaxy-compatible server
  • vcs_url: VCS URL for git-sourced collections
  • download_url: Direct tarball URL
  • packaging: Distribution method (rpm, deb)

A corresponding change to ansible-core will be submitted to write the required metadata during collection installation, enabling scanners to determine the installation source.

Fixes package-url#853 add new PURL type `ansible` for identifying
Ansible collections.

Ansible collections can be installed from multiple sources:
- Ansible Galaxy (default)
- Red Hat Automation Hub
- Git repositories
- Direct URLs/tarballs
- System packages (RPM/deb)

This type definition enables scanners to generate accurate PURLs for
Ansible collections in SBOMs and vulnerability databases.

Qualifiers:
- repository_url: Alternative Galaxy-compatible server
- vcs_url: VCS URL for git-sourced collections
- download_url: Direct tarball URL
- packaging: Distribution method (rpm, deb)

A corresponding change to ansible-core will be submitted to write
source.json metadata during collection installation, enabling
scanners to determine the installation source.
anweshadas added a commit to anweshadas/ansible that referenced this pull request Apr 7, 2026
Add source.json file creation when installing collections via ansible-galaxy.

This enables SBOM scanners (like Syft) to generate accurate Package URLs
(PURLs) for Ansible collections by recording the installation source.

The source.json file is written to the collection directory and contains:
- format_version: Schema version (1.0.0)
- namespace, name, version: Collection identity
- type: Installation source type (galaxy, git, url, file, dir)
- repository_url: Galaxy-compatible server URL (for galaxy type)
- download_url: Direct artifact URL (for galaxy/url types)
- vcs_url: VCS URL with git+ prefix (for git type)

Examples:
- Galaxy: type=galaxy, repository_url=https://galaxy.ansible.com
- Automation Hub: type=galaxy, repository_url=https://console.redhat.com/api/automation-hub/
- Git: type=git, vcs_url=git+https://github.com/org/repo.git@tag
- URL: type=url, download_url=https://example.com/collection.tar.gz
- Local: type=file or type=dir (no path stored)

This change supports the new 'ansible' PURL type being proposed at:
package-url/purl-spec#854
anweshadas added a commit to anweshadas/ansible that referenced this pull request Apr 7, 2026
Add source.json file creation when installing collections via ansible-galaxy.

This enables SBOM scanners (like Syft) to generate accurate Package URLs
(PURLs) for Ansible collections by recording the installation source.

The source.json file is written to the collection directory and contains:
- format_version: Schema version (1.0.0)
- namespace, name, version: Collection identity
- type: Installation source type (galaxy, git, url, file, dir)
- repository_url: Galaxy-compatible server URL (for galaxy type)
- download_url: Direct artifact URL (for galaxy/url types)
- vcs_url: VCS URL with git+ prefix (for git type)

Examples:
- Galaxy: type=galaxy, repository_url=https://galaxy.ansible.com
- Automation Hub: type=galaxy, repository_url=https://console.redhat.com/api/automation-hub/
- Git: type=git, vcs_url=git+https://github.com/org/repo.git@tag
- URL: type=url, download_url=https://example.com/collection.tar.gz
- Local: type=file or type=dir (no path stored)

This change supports the new 'ansible' PURL type being proposed at:
package-url/purl-spec#854
anweshadas added a commit to anweshadas/ansible that referenced this pull request Apr 7, 2026
Add source.json file creation when installing collections via ansible-galaxy.

This enables SBOM scanners (like Syft) to generate accurate Package URLs
(PURLs) for Ansible collections by recording the installation source.

The source.json file is written to the collection directory and contains:
- format_version: Schema version (1.0.0)
- namespace, name, version: Collection identity
- type: Installation source type (galaxy, git, url, file, dir)
- repository_url: Galaxy-compatible server URL (for galaxy type)
- download_url: Direct artifact URL (for galaxy/url types)
- vcs_url: VCS URL with git+ prefix (for git type)

Examples:
- Galaxy: type=galaxy, repository_url=https://galaxy.ansible.com
- Automation Hub: type=galaxy, repository_url=https://console.redhat.com/api/automation-hub/
- Git: type=git, vcs_url=git+https://github.com/org/repo.git@tag
- URL: type=url, download_url=https://example.com/collection.tar.gz
- Local: type=file or type=dir (no path stored)

This change supports the new 'ansible' PURL type being proposed at:
package-url/purl-spec#854
anweshadas added a commit to anweshadas/ansible that referenced this pull request Apr 7, 2026
Add source.json file creation when installing collections via ansible-galaxy.

This enables SBOM scanners (like Syft) to generate accurate Package URLs
(PURLs) for Ansible collections by recording the installation source.

The source.json file is written to the collection directory and contains:
- format_version: Schema version (1.0.0)
- namespace, name, version: Collection identity
- type: Installation source type (galaxy, git, url, file, dir)
- repository_url: Galaxy-compatible server URL (for galaxy type)
- download_url: Direct artifact URL (for galaxy/url types)
- vcs_url: VCS URL with git+ prefix (for git type)

Examples:
- Galaxy: type=galaxy, repository_url=https://galaxy.ansible.com
- Automation Hub: type=galaxy, repository_url=https://console.redhat.com/api/automation-hub/
- Git: type=git, vcs_url=git+https://github.com/org/repo.git@tag
- URL: type=url, download_url=https://example.com/collection.tar.gz
- Local: type=file or type=dir (no path stored)

This change supports the new 'ansible' PURL type being proposed at:
package-url/purl-spec#854
anweshadas added a commit to anweshadas/ansible that referenced this pull request Apr 7, 2026
Add source.json file creation when installing collections via ansible-galaxy.

This enables SBOM scanners (like Syft) to generate accurate Package URLs
(PURLs) for Ansible collections by recording the installation source.

The source.json file is written to the collection directory and contains:
- format_version: Schema version (1.0.0)
- namespace, name, version: Collection identity
- type: Installation source type (galaxy, git, url, file, dir)
- repository_url: Galaxy-compatible server URL (for galaxy type)
- download_url: Direct artifact URL (for galaxy/url types)
- vcs_url: VCS URL with git+ prefix (for git type)

Examples:
- Galaxy: type=galaxy, repository_url=https://galaxy.ansible.com
- Automation Hub: type=galaxy, repository_url=https://console.redhat.com/api/automation-hub/
- Git: type=git, vcs_url=git+https://github.com/org/repo.git@tag
- URL: type=url, download_url=https://example.com/collection.tar.gz
- Local: type=file or type=dir (no path stored)

This change supports the new 'ansible' PURL type being proposed at:
package-url/purl-spec#854
Comment thread types/ansible-definition.json Outdated
Comment thread types/ansible-definition.json Outdated
Comment thread types/ansible-definition.json Outdated
mjherzog and others added 2 commits April 16, 2026 09:35
Use Ansible's native comma syntax for VCS URL version references instead
of pip/SPDX @ syntax. ansible-galaxy uses a comma to separate the git
ref (e.g., git+https://...repo.git,tag), and the @ sign is treated as
part of the URL, causing installs to fail.

- Update vcs_url qualifier description and example to use comma separator
with real-world community.general collection
- Fix download_url example tarball name to match the "custom" namespace
- Add collections installing guide to reference_urls
@mjherzog mjherzog changed the title add: ansible type definition Add new PURL type: 'ansible' Apr 28, 2026
@mjherzog mjherzog added the PURL type new Register a new PURL type label Apr 28, 2026
Comment on lines +37 to +39
"key": "vcs_url",
"requirement": "optional",
"description": "URL for a version control repository when the collection is installed directly from source rather than a Galaxy-compatible server. Ansible uses a comma to separate the version reference (e.g., git+https://github.com/ansible-collections/community.general.git,12.5.0)."

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

  • vcs_url format contradicts the purl-spec standard

The ansible-galaxy CLI uses a comma to separate the version reference, but docs/common-qualifiers.md states that vcs_url should follow Python pip syntax or the SPDX specification.

Please could a maintainer to let us know if this is acceptable or do we need to modify to match the standard convention.

Comment thread types/ansible-definition.json Outdated
Comment on lines +46 to +50
{
"key": "packaging",
"requirement": "optional",
"description": "Distribution packaging method when not installed via ansible-galaxy (e.g., rpm, deb). Omit for standard ansible-galaxy installs. Scanners should detect RPM/deb-installed collections by checking if the collection path is system-managed and cross-referencing with the package database."
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

  • Packaging qualifier is a possible design smell

The definition includes packaging=rpm / packaging=deb for system-installed collections. This could be problematic:

  • There is already a pkg:rpm/ PURL, should this be re-used instead?
  • The RPM and ansible collection versions can differ; the RPM package name may not always follow the collection namespace/name version format.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The PURL should follow the package manager type when available - so this should be an rpm PURL. Many ecosystems have multiple package options.

This is correct

Co-authored-by: Daniel Brennand <52419383+dbrennand@users.noreply.github.com>
Signed-off-by: Michael Herzog <mjherzog@aboutcode.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PURL type new Register a new PURL type

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Register new PURL type: 'ansible' for Ansible Collections

3 participants