Interview Prep/Ansible/Testing, CI/CD and Quality

How do you upgrade ansible-core safely across a large codebase?

AdvancedProductionTesting, CI/CD and Quality
Answer

Treat it like a language upgrade, because it is one. ansible-core 2.19 is the recent example: its templating changes made non-boolean conditionals and some implicit conversions errors, and plenty of old playbooks broke.

  1. Read the porting guide for the target version and grep for the deprecated patterns it lists.
  2. Clear all [DEPRECATION WARNING] lines on the current version first; they are the next version's errors.
  3. Build a new EE (or virtualenv) with the new core and pinned collections.
  4. Run lint, Molecule and --check runs of every playbook against staging in CI with both the old and new image.
  5. Move one environment at a time: dev, staging, then prod, with the old image kept as a quick fallback.

Pin the core version everywhere (EE tag, requirements.txt), so nobody gets upgraded by a stray pip install -U.

All Ansible questions Roadmap: Ansible

More on Testing, CI/CD and Quality