Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add create-sbom play #517

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions playbooks/generic/create-sbom.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
- name: Create SBOM
hosts: "{{ hosts_default_group|default('generic') }}"
serial: "{{ osism_serial['manage_container']|default(1) }}"
strategy: "{{ osism_strategy|default('linear') }}"

vars:
docker_registry_syft: index.docker.io
# renovate: datasource=docker depName=anchore/syft
syft_tag: 'v1.14.1'
syft_image: "{{ docker_registry_syft }}/anchore/syft:{{ syft_tag }}"

syft_output_directory: /opt/syft

tasks:
- name: Point out that the following task takes some time and does not give any output
ansible.builtin.debug:
msg: "The task 'Create SBOM' takes a few minutes to complete."

- name: Create output directory
become: true
ansible.builtin.file:
path: "{{ syft_output_directory }}"
owner: "{{ operator_user | default('dragon') }}"
group: "{{ operator_group | default('dragon') }}"
state: directory
mode: 0755

- name: Create SBOM
community.docker.docker_container:
name: syft-create-sbom
image: "{{ syft_image }}"
volumes:
- "{{ syft_output_directory }}:/output:rw"
mounts:
- type: bind
source: /
target: /data
read_only: true
command: |
dir:/data -o cyclonedx=/output/sbom.cyclonedx.xml
detach: false
async: 1800
poll: 5

- name: Remove create-sbom-with-syft container
community.docker.docker_container:
name: syft-create-sbom
state: absent