u/InspectionCold1062

▲ 25 r/ansible

Open-source tool to convert Puppet manifests to Ansible (100% local, no AI APIs used for conversion)

Hey everyone,

I’ve been working on a Python tool called p2a (puppet-to-ansible) to help automate the migration of legacy Puppet codebases to Ansible.

I wanted a solution that was strictly local—no sending infrastructure code or secrets to external LLM APIs. It uses a deterministic parser built with the Lark library.

Main features:

  • Local Parsing: Converts .pp manifests and full modules to Ansible roles/playbooks on your machine.
  • Templates: Converts ERB to Jinja2.
  • Hiera: Resolves Hiera lookups into Ansible defaults/vars.
  • Safety: If the parser hits something too complex, it leaves a valid Ansible task with a # TODO comment containing the original code.

On the AI side: To be fully transparent, I used Claude Code to help write the parser logic and the boilerplate. To make sure the output isn't "hallucinated," I’ve implemented over 200 tests to validate the conversion logic.

How to get it: The package is available on PyPI (pip). You can install it with: pip install puppet-to-ansible

The CLI command is p2a.

How to find the code: "puppet-to-ansible"  (user_gh: pavelux00x).

I’m looking for feedback! If you have some old Puppet manifests, please try to run them through the tool and let me know where it breaks or where I can improve the Ansible output best practices.

Thanks!

reddit.com
u/InspectionCold1062 — 8 days ago