darkwizard242/ansible-role-grype
GitHub: darkwizard242/ansible-role-grype
用于在 Debian/Ubuntu 和 EL 系统上自动化安装和管理 Grype 漏洞扫描器的 Ansible Role。
Stars: 4 | Forks: 0
[](https://github.com/darkwizard242/ansible-role-grype/actions?query=workflow%3Abuild-and-test) [](https://github.com/darkwizard242/ansible-role-grype/actions?query=workflow%3Arelease)  [](https://sonarcloud.io/dashboard?id=ansible-role-grype) [](https://sonarcloud.io/dashboard?id=ansible-role-grype) [](https://sonarcloud.io/dashboard?id=ansible-role-grype)  
# Ansible Role: grype
用于在 **Debian/Ubuntu** 和 **EL** 系统上安装(_默认_)[grype](https://github.com/anchore/grype) 的 Role。一个用于容器镜像和文件系统的漏洞扫描器。
## 需求
无。
## Role 变量
可用的变量列出如下(位于 `defaults/main.yml` 中):
### 变量列表:
```
grype_app: grype
grype_desired_state: present
grype_version: 0.109.1
grype_os: "{{ ansible_system | lower }}"
grype_architecture_map:
amd64: amd64
arm: arm64
x86_64: amd64
armv6l: armv6
armv7l: armv7
aarch64: arm64
32-bit: "386"
64-bit: amd64
# 适用于 Debian/Ubuntu 系列
grype_debian_url: "https://github.com/anchore/{{ grype_app }}/releases/download/v{{ grype_version }}/{{ grype_app }}_{{ grype_version }}_{{ grype_os }}_{{ grype_architecture_map[ansible_architecture] }}.deb"
# 适用于 EL 系列
grype_el_url: "https://github.com/anchore/{{ grype_app }}/releases/download/v{{ grype_version }}/{{ grype_app }}_{{ grype_version }}_{{ grype_os }}_{{ grype_architecture_map[ansible_architecture] }}.rpm"
```
### 变量表:
Variable | Description
---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------
grype_app | 定义要安装的应用程序,即 **grype**
grype_desired_state | 定义动态选择是安装(即 `present` 或 `latest`)还是卸载(即 `absent`)该软件包。默认为 `present`。
grype_version | 定义动态获取要安装的所需版本。默认为:**0.109.1**
grype_os | 定义操作系统类型。用于根据操作系统类型获取正确类型的二进制文件。
grype_architecture_map | 定义操作系统架构。用于根据操作系统系统架构获取正确类型的二进制文件。
grype_debian_url | 定义用于 Debian/Ubuntu 系列系统下载 'deb' 软件包的 URL。
grype_el_url | 定义用于 EL 系列系统下载 'rpm' 软件包的 URL。
## 依赖
无
## 示例 Playbook
展示在 ansible playbooks 中该 Role 的默认行为(即安装 **grype**)。
```
- hosts: servers
roles:
- darkwizard242.grype
```
展示在 ansible playbooks 中自定义该 Role 的行为(即指定所需的 **grype** 版本)。
```
- hosts: servers
roles:
- darkwizard242.grype
vars:
grype_version: 0.27.3
```
展示在 ansible playbooks 中自定义该 Role 的行为(即不同操作系统架构的 **grype** 软件包,如 arm64)。
```
- hosts: servers
roles:
- darkwizard242.grype
vars:
grype_arch: "arm64"
```
## 许可证
[MIT](https://github.com/darkwizard242/ansible-role-grype/blob/master/LICENSE)
## 作者信息
此 Role 由 [Ali Muhammad](https://www.alimuhammad.dev) 创建
标签:Anchore, Angular, Ansible Galaxy, Ansible Role, CICD, Debian, EC2, EL, Grype, IaC, SBOM, Vue, Web截图, 安装部署, 容器安全, 文件系统扫描, 日志审计, 测试覆盖率, 硬件无关, 系统提示词, 自动化运维