Enables conversion of Chef resources to Ansible tasks and playbooks, with support for generating AWX/AAP job templates, workflows, projects, dynamic inventory sources, and Ansible Vault files from Chef configurations.
Provides comprehensive Chef cookbook analysis and parsing capabilities, including recipes, attributes, metadata, templates (ERB), custom resources, data bags, environments, and search patterns for migration to Ansible.
SousChef š³
An AI-powered MCP (Model Context Protocol) server that provides comprehensive Chef-to-Ansible migration capabilities for enterprise infrastructure transformation.
Overview
SousChef is a complete enterprise-grade migration platform with 34 MCP tools organized across 8 major capability areas to facilitate Chef-to-Ansible AWX/AAP migrations. From cookbook analysis to deployment pattern conversion, SousChef provides everything needed for a successful infrastructure automation migration.
š Core Capabilities
1. Chef Cookbook Analysis & Parsing
Complete cookbook introspection and analysis tools:
parse_template - Parse ERB templates with Jinja2 conversion and variable extraction
parse_custom_resource - Extract properties, attributes, and actions from custom resources and LWRPs
list_directory - Navigate and explore cookbook directory structures
read_file - Read cookbook files with error handling
read_cookbook_metadata - Parse metadata.rb files for dependencies and cookbook information
parse_recipe - Analyze Chef recipes and extract resources, actions, and properties
parse_attributes - Parse attribute files (default, override, normal) with precedence analysis
list_cookbook_structure - Display complete cookbook directory hierarchy
2. Chef-to-Ansible Conversion Engine
Advanced resource-to-task conversion with intelligent module selection:
convert_resource_to_task - Transform individual Chef resources to Ansible tasks
generate_playbook_from_recipe - Generate complete Ansible playbooks from Chef recipes
3. Chef Search & Inventory Integration
Convert Chef search patterns to dynamic Ansible inventory:
convert_chef_search_to_inventory - Transform Chef search queries to Ansible inventory groups
generate_dynamic_inventory_script - Create dynamic inventory scripts from Chef server queries
analyze_chef_search_patterns - Discover and analyze search usage in cookbooks
4. InSpec Integration & Validation
Complete InSpec-to-Ansible testing pipeline:
parse_inspec_profile - Parse InSpec profiles and extract controls
convert_inspec_to_test - Convert InSpec controls to Testinfra or Ansible assert tasks
generate_inspec_from_recipe - Auto-generate InSpec validation from Chef recipes
5. Data Bags & Secrets Management
Chef data bags to Ansible vars/vault conversion:
convert_chef_databag_to_vars - Transform data bags to Ansible variable files
generate_ansible_vault_from_databags - Convert encrypted data bags to Ansible Vault
analyze_chef_databag_usage - Analyze data bag usage patterns in cookbooks
6. Environment & Configuration Management
Chef environments to Ansible inventory groups:
convert_chef_environment_to_inventory_group - Transform Chef environments to inventory
generate_inventory_from_chef_environments - Generate complete inventory from environments
analyze_chef_environment_usage - Analyze environment usage in cookbooks
7. AWX/Ansible Automation Platform Integration
Enterprise AWX/AAP configuration generation:
generate_awx_job_template_from_cookbook - Create AWX job templates from cookbooks
generate_awx_workflow_from_chef_runlist - Transform Chef run-lists to AWX workflows
generate_awx_project_from_cookbooks - Generate AWX projects from cookbook collections
generate_awx_inventory_source_from_chef - Create dynamic inventory sources from Chef server
8. Advanced Deployment Patterns & Migration Assessment
Modern deployment strategies and migration planning:
convert_chef_deployment_to_ansible_strategy - Convert deployment recipes to Ansible strategies
generate_blue_green_deployment_playbook - Create blue/green deployment playbooks
generate_canary_deployment_strategy - Generate canary deployment configurations
analyze_chef_application_patterns - Identify application deployment patterns
assess_chef_migration_complexity - Comprehensive migration complexity assessment
generate_migration_plan - Create detailed migration execution plans
analyze_cookbook_dependencies - Analyze dependencies and migration order
generate_migration_report - Generate executive and technical migration reports
šÆ Migration Workflow
Phase 1: Discovery & Assessment
Phase 2: Content Conversion
Phase 3: AWX/AAP Integration
Phase 4: Validation & Testing
š Enterprise Features
Migration Assessment & Reporting
Complexity Analysis: Automated assessment of migration effort and risk factors
Dependency Mapping: Complete cookbook dependency analysis with migration ordering
Impact Analysis: Resource usage patterns and conversion recommendations
Executive Reports: Stakeholder-ready migration reports with timelines and costs
Modern Deployment Patterns
Blue/Green Deployments: Zero-downtime deployment strategies
Canary Releases: Gradual rollout configurations
Application Patterns: Modern containerized and cloud-native deployment patterns
Rollback Strategies: Automated failure recovery procedures
Enterprise Integration
AWX/AAP Ready: Native Ansible Automation Platform integration
Dynamic Inventory: Chef server integration for hybrid environments
Secrets Management: Secure data bag to Vault conversion
Multi-Environment: Production-ready inventory and variable management
š ļø Installation & Setup
Prerequisites
Python 3.14+
uv for dependency management
MCP-compatible client (Claude Desktop, VS Code with MCP extension, etc.)
Quick Start
Clone and setup:
git clone https://github.com/your-org/souschef cd souschef uv syncConfigure MCP client (Claude Desktop example):
{ \"mcpServers\": { \"souschef\": { \"command\": \"uv\", \"args\": [\"--directory\", \"/path/to/souschef\", \"run\", \"souschef\"], \"env\": {} } } }Start using SousChef: Ask your MCP client: "Analyze the cookbook at /path/to/my/cookbook" or "Convert this Chef recipe to an Ansible playbook"
Command Line Interface (CLI)
SousChef includes a standalone CLI for direct cookbook parsing and conversion:
Available Commands:
recipe- Parse Chef recipe files and extract resourcestemplate- Convert ERB templates to Jinja2 with variable extractionresource- Parse custom resources and LWRPsattributes- Extract Chef attribute definitionsmetadata- Parse cookbook metadata.rb filesstructure- Display cookbook directory structureconvert- Convert Chef resources to Ansible taskscookbook- Comprehensive cookbook analysisinspec-parse- Parse InSpec profiles and controlsinspec-convert- Convert InSpec to Testinfra/Ansible testsinspec-generate- Generate InSpec validation from recipesls/cat- File system operations
Development Setup\n\nbash\n# Install dependencies\nuv sync\n\n# Run tests\nuv run pytest\n\n# Run with coverage\nuv run pytest --cov=souschef --cov-report=html\n\n# Lint and format\nuv run ruff check .\nuv run ruff format .\n
šļø Architecture & Design
MCP Protocol Integration
SousChef leverages the Model Context Protocol (MCP) to provide seamless integration with AI assistants and development environments:
34 Specialized Tools: Each migration capability exposed as dedicated MCP tool
Type-Safe Interfaces: Full Python type hints for reliable AI interactions
Comprehensive Error Handling: Graceful degradation and helpful error messages
Streaming Support: Efficient handling of large cookbook conversions
Testing Strategy
Following enterprise-grade testing standards:
Unit Tests: Mock-based testing for individual functions (tests/test_server.py)
Integration Tests: Real cookbook testing with fixtures (tests/test_integration.py)
Property-Based Tests: Hypothesis fuzz testing for edge cases (tests/test_property_based.py)
82% Coverage: Comprehensive test coverage with goal of 95% for production readiness
Quality Assurance
Zero Warnings Policy: All code passes linting without disabling checks
Type Safety: Complete type annotations throughout the codebase
Automated Testing: CI/CD pipeline with comprehensive test suites
Documentation: Detailed docstrings and usage examples
š Documentation
Tool Reference
Each MCP tool includes comprehensive documentation:
Purpose and use cases
Parameter descriptions and types
Return value specifications
Usage examples and patterns
Error handling behaviors
Migration Guides
Enterprise Migration Guide - Complete methodology for large-scale migrations
AWX Integration Guide - Step-by-step AWX/AAP setup and configuration
Testing Strategy Guide - Validation and testing approaches
Best Practices - Recommended patterns and approaches
š¤ Contributing
We welcome contributions! Please see CONTRIBUTING.md for:
Development setup and workflow
Code style and testing requirements
Pull request process
Issue reporting guidelines
š License
This project is licensed under the MIT License - see the LICENSE file for details.
š Roadmap
Completed ā
ā Complete Chef cookbook parsing (recipes, attributes, metadata, templates)
ā InSpec profile parsing and conversion to Testinfra/Ansible tests
ā Chef resource to Ansible task conversion with module mapping
ā Data bags to Ansible Vault conversion
ā Chef environments to Ansible inventory conversion
ā Chef search patterns to dynamic inventory conversion
ā AWX/AAP job templates, workflows, and project generation
ā Blue/green and canary deployment pattern generation
ā Migration complexity assessment and planning tools
ā Comprehensive testing suite (unit, integration, property-based)
ā Command-line interface (CLI) for standalone usage
In Progress š
š Enhanced error handling and user experience
š Documentation website and interactive examples
š Performance optimizations for large-scale migrations
Planned š
š Chef Habitat to containerized deployment conversion
š Integration with additional test frameworks (ServerSpec, Goss)
š Visual migration planning and dependency mapping interface
š Terraform provider for infrastructure state management
š Jenkins/GitLab CI pipeline generation
š Custom resource conversion framework
š Advanced templating and variable substitution patterns
šāāļø Support & Community
Issues: GitHub Issues
Discussions: GitHub Discussions
Documentation: Wiki
SousChef - Transforming infrastructure automation, one recipe at a time. š³āØ desc 'Ensure package nginx is properly configured' impact 1.0
describe package('nginx') do it { should be_installed } end end
control 'service-nginx' do title 'Verify service nginx' desc 'Ensure service nginx is properly configured' impact 1.0
describe service('nginx') do it { should be_running } it { should be_enabled } end end
control 'template--etc-nginx-nginx.conf' do title 'Verify template /etc/nginx/nginx.conf' desc 'Ensure template /etc/nginx/nginx.conf is properly configured' impact 1.0
describe file('/etc/nginx/nginx.conf') do it { should exist } its('mode') { should cmp '0644' } its('owner') { should eq 'root' } its('group') { should eq 'root' } end end
Ansible Assert Integration
For Ansible playbook validation:
Benefits
Consistency Validation - Ensure Chef and Ansible produce identical infrastructure state
AI Context Enhancement - InSpec profiles help AI understand infrastructure intent
Automated Testing - Generate tests automatically from Chef recipes
Multiple Test Formats - Support for InSpec, Testinfra, and Ansible assert
CI/CD Integration - Easy integration with existing test pipelines
As an MCP Server
SousChef is designed to be used as an MCP server with AI assistants that support the Model Context Protocol.
Configure with Claude Desktop
Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
Available Tools
list_directory(path: str)
List the contents of a directory.
Example:
read_file(path: str)
Read the contents of a file.
Example:
read_cookbook_metadata(path: str)
Parse Chef cookbook metadata.rb file.
Example:
parse_recipe(path: str)
Parse a Chef recipe file and extract resources.
Example:
parse_attributes(path: str)
Parse a Chef attributes file and extract attribute definitions.
Example:
list_cookbook_structure(path: str)
List the structure of a Chef cookbook directory.
Example:
parse_template(path: str)
Parse a Chef ERB template file and convert it to Jinja2 format.
Example:
ERB to Jinja2 Conversion:
Variable output:
<%= var %>ā{{ var }}Instance variables:
<%= @var %>ā{{ var }}Node attributes:
<%= node['attr'] %>ā{{ attr }}Conditionals:
<% if cond %>ā{% if cond %}Unless:
<% unless cond %>ā{% if not cond %}Elsif:
<% elsif cond %>ā{% elif cond %}Else:
<% else %>ā{% else %}Loops:
<% arr.each do |item| %>ā{% for item in arr %}End blocks:
<% end %>ā{% endif %}or{% endfor %}
parse_custom_resource(path: str)
Parse a Chef custom resource or LWRP file and extract properties, attributes, and actions.
Example:
Detected Resource Types:
Custom Resource (modern) - Uses
propertykeywordLWRP (legacy) - Uses
attributekeyword withkind_of:
Property/Attribute Fields:
name- Property/attribute nametype- Type constraint (String, Integer, Boolean, Array, Hash, etc.)name_property- Whether this is the resource's name property (true/false)default- Default value if specifiedrequired- Whether the property is required (true/false)
Action Extraction:
Modern format:
action :name do ... endLWRP format:
actions :create, :delete, :updateSupports both formats and mixed declarations
convert_resource_to_task(resource_type: str, resource_name: str, action: str = "create", properties: str = "")
Convert a Chef resource to an Ansible task.
Example:
Supported Resource Types:
packageāansible.builtin.packageserviceāansible.builtin.servicetemplateāansible.builtin.templatefileāansible.builtin.filedirectoryāansible.builtin.file(with state: directory)executeāansible.builtin.commandbashāansible.builtin.shelluserāansible.builtin.usergroupāansible.builtin.groupAnd more...
Development
Project Structure
Development Standards
Code Quality: Zero warnings policy, type hints required, Google-style docstrings
Testing: High test coverage (82%) using pytest with goal of 100%
Linting: Code must pass
ruff checkwith no violationsFormatting: Code must be formatted with
ruff format
See .github/copilot-instructions.md for detailed development guidelines.
Running Tests
Test Types
The project includes multiple types of tests:
Unit Tests (
test_server.py)Mock-based tests for individual functions
Test error handling and edge cases
Fast execution, isolated from filesystem
Integration Tests (
test_integration.py)Real file operations with test fixtures
Validate parsing with actual Chef cookbook files
Parameterized tests for various scenarios
Performance benchmarks with pytest-benchmark
Property-Based Tests (
test_property_based.py)Uses Hypothesis for fuzz testing
Generates random inputs to find edge cases
Ensures functions handle any input gracefully
Test Fixtures
Sample Chef cookbook in
tests/fixtures/sample_cookbook/Real-world metadata, recipes, and attributes
Used for integration testing
Test Coverage
The project maintains 82% test coverage with a goal of 95%+. Run coverage with HTML report:
Mutation Testing
To verify test quality with mutation testing:
VS Code Tasks
The project includes several VS Code tasks:
Run Tests - Execute test suite
Run Tests with Coverage - Generate coverage reports
Lint (Ruff) - Check code quality
Format (Ruff) - Auto-format code
Lint & Test - Run both linting and tests
Contributing
Contributions are welcome! Please ensure:
All tests pass
Code coverage remains at 100%
Code passes ruff linting
All functions have type hints and docstrings
Follow the development standards in
.github/copilot-instructions.md
License
TBD
Roadmap
Add server entry point and runner
Implement Chef ā Ansible resource conversion (basic)
Support template conversion (ERB ā Jinja2)
Parse custom Chef resources/LWRPs
Generate complete Ansible playbooks from recipes
Handle Chef guards (only_if, not_if) and notifications
Support complex attribute precedence and merging
Add conversion validation and testing
Handle Chef search and data bags