diodonfrost.sonar_scanner
ansible-role-sonar-scanner
该角色用于在目标主机上安装 sonar-scanner。
需求
该角色使用 Ansible 2.5 开发,不保证向后兼容。
使用 ansible-galaxy install diodonfrost.sonar_scanner
在系统上安装该角色。
支持的平台:
- 名称: EL
版本:
- 8
- 7
- 6
- 名称: Fedora
版本:
- 31
- 30
- 29
- 28
- 27
- 26
- 名称: Debian
版本:
- stretch
- jessie
- wheezy
- squeeze
- 名称: Ubuntu
版本:
- disco
- bionic
- xenial
- trusty
- precise
- 名称: OracleLinux
版本:
- 7
- 6
- 名称: Amazon
版本:
- 2017.12
- 2016.03
- 2013.09
- 名称: opensuse
版本:
- 42.3
- 42.2
- 42.1
- 13.2
- 名称: SLES
版本:
- 15
- 名称: ArchLinux
版本:
- 任何
- 名称: Alpine
版本:
- 任何
- 名称: Gentoo
版本:
- stage3
- 名称: MacOSX
版本:
- 10.13
- 10.12
- 10.11
- 10.10
- 名称: Windows
版本:
- 2016
- 2012R2
- 8.1
角色变量
该角色有多个变量。这些变量的默认值如下:
---
# ansible-role-sonar-scanner 的默认文件
# 定义要安装的 sonar-scanner 版本
# 可选值: https://api.github.com/repos/sonarsource/sonar-scanner-cli/tags
# 默认值: latest
sonar_scanner_version: latest
# 定义安装 Sonar Scanner 客户端的目录
# Linux/Unix 默认值: /opt
sonar_scanner_directory: "{{ sonar_scanner_default_directory }}"
# 定义安装 Sonar Scanner 客户端二进制文件的位置
# Linux/Unix 默认值: /usr/local/bin
# Windows 默认值: %PROGRAMFILES%
sonar_scanner_path: "{{ sonar_scanner_default_path }}"
依赖
无
示例剧本
这是一个示例剧本文件,用于在 localhost 上部署 Ansible Galaxy sonar-scanner 角色并安装最新的 sonar-scanner 版本。
---
- hosts: localhost
become: true
roles:
- role: diodonfrost.sonar_scanner
该角色还可以安装特定版本的 sonar-scanner。
---
- hosts: localhost
become: true
roles:
- role: ansible-role-sonar_scanner
vars:
sonar-scanner_version: 3.3.0.1492
本地测试
该项目使用 Molecule 来帮助开发和测试。
要进行开发或测试,您需要安装以下内容:
- Linux(例如 Ubuntu)
- Docker
- Python(包括 python-pip)
- Ansible
- Molecule
- Virtualbox(仅限 Windows 测试)
- Vagrant(仅限 Windows 测试)
使用 Docker 进行测试
# 使用 centos 8 测试 ansible 角色
molecule test
# 使用 ubuntu 20.04 测试 ansible 角色
image=ansible-ubuntu:20.04 molecule test
# 使用 alpine 测试 ansible 角色
image=ansible-alpine:latest molecule test
# 创建 centos 7 实例
image=ansible-centos:7 molecule create
# 在 centos 7 实例上应用角色
image=ansible-centos:7 molecule converge
# 在 centos 7 实例上启动测试
image=ansible-centos:7 molecule verify
使用 Vagrant 和 Virtualbox 进行测试
# 测试 Windows 上的 ansible 角色
molecule test -s windows
许可
Apache 2
作者信息
该角色由 diodonfrost 于 2019 年创建。