ansible-inspec: Bridging Infrastructure Automation and Compliance Testing
A Developer's Journey into Compliance as Code
β‘ Quick Start (TL;DR)
pip install ansible-inspecansible-inspec exec my-profile/ --target ssh://hostname \
--reporter json --output report.jsonansible-inspec exec dev-sec/linux-baseline --supermarket \
--target ssh://hostname --reporter html --output report.htmlπ€ First, Let's Talk About the Compliance Problem
The Problem I Kept Running Into
Enter ansible-inspec: One Tool, Two Powers
Why This Matters for DevOps Teams
π What ansible-inspec Actually Does
π οΈ The Toolbox: 3 Core Modes
1. Native InSpec Execution
2. Profile Conversion (InSpec-Free Mode)
3. Chef Supermarket Integration
π― Multi-Format Reporting
π‘ The InSpec-Free Magic
βοΈ Getting Started: Your First 10 Minutes
Installation
The First Compliance Check
Step 1: Create a Simple Inventory
Step 2: Run a Supermarket Profile
Step 3: View Your Report
Going InSpec-Free
π How It Works: The Architecture
System Architecture
Key Components:
Execution Flow
Sequence of Operations
The Flow (Native Mode):
The Flow (InSpec-Free Mode):
Real-World Use Cases: Automating Personal Infrastructure
Automating Linux Lab Server Compliance
K3s Cluster Security Validation
Periodic Compliance Monitoring
π‘ Pro Tips from the Trenches
1. Parallel Everything
2. Filter by Tags
3. Use Variables in Converted Collections
4. Archive Reports for Audit Trails
5. Create Custom Supermarket Searches
6. Combine with Ansible Vault
π Troubleshooting
InSpec Not Found?
Reports Not Generating?
Conversion Errors?
Slow Execution?
π Why This is Game-Changing
π Getting Started Today
π Reflections: Why This Matters
The Bigger Picture
An Invitation
π Resources
Quick Start Reminder:
π¬ Let's Connect
Last updated