How do you test a playbook that talks to real cloud APIs without paying for resources?
AdvancedScenarioPerformance, Testing and CI/CD
Answer
Situation read → Cloud provisioning tests are slow and costly.
What I'd do →
- Separate provisioning from configuration; test configuration with containers (Molecule).
- Test provisioning against a sandbox account with tagged, auto-expiring resources.
- Use LocalStack for supported AWS services via
endpoint_url. - Always run a
destroyinalways.
Why → Config logic is where most bugs live and it tests cheaply in containers.
Interview tip → Tag all test resources and run a nightly janitor.
More on Performance, Testing and CI/CD
A playbook that touches 200 hosts takes 40 minutes. Where do you start tuning?IntermediateYou install 15 packages with a loop and it is slow.BeginnerHow would you test a role in CI before it reaches production?IntermediateWhat would a Molecule `verify.yml` check for an Nginx role?IntermediateMolecule's idempotence step fails. How do you find the offending task?IntermediateDesign a CI pipeline for an Ansible repo.Advanced