Quick Reference

Essential commands and examples for ansible-inspec.

Installation

# PyPI (recommended)
pip install ansible-inspec

# Docker
docker pull htunnthuthu/ansible-inspec:latest

# Verify installation
ansible-inspec --version

Common Commands

Execute InSpec Profiles

# Local system
ansible-inspec exec profile/ --target local://

# Remote host
ansible-inspec exec profile/ --target user@hostname

# Ansible inventory
ansible-inspec exec profile/ --target inventory.yml

# Docker container
ansible-inspec exec profile/ --target docker://container_name

Generate Reports

Convert Profiles

Chef Supermarket

Python API

Docker Usage

Common Workflows

Workflow 1: Download and Run CIS Benchmark

Workflow 2: Convert Profile to Ansible Collection

Workflow 3: CI/CD Integration

Workflow 4: Multi-Host Compliance Scan

Report Formats

JSON (InSpec Schema)

Use for:

  • API integration

  • Custom tooling

  • Data analysis

  • CI/CD pipelines

HTML (Interactive)

Use for:

  • Human review

  • Stakeholder reports

  • Audit documentation

JUnit XML

Use for:

  • Jenkins integration

  • GitLab CI

  • GitHub Actions

  • Azure DevOps

Filtering Controls

Environment Variables

Common Issues

InSpec Not Found

Native mode requires InSpec:

Or use InSpec-free mode:

Permission Denied

Connection Timeout

Tips and Tricks

Dry Run

Verbose Output

Background Execution

Auto-Reporting with Collections

Resources

  • PyPI: https://pypi.org/project/ansible-inspec/

  • Docker Hub: https://hub.docker.com/r/htunnthuthu/ansible-inspec

  • GitHub: https://github.com/Htunn/ansible-inspec

  • API Docs: docs/API.md

License

GPL-3.0-or-later

Last updated