Ansible error on new machine: "Package 'python-apt' has no installation candidate"

Published: 3 years ago web dev

I ran into this error on a brand new Digital Ocean machine recently. It's one of those things you end up really confused about but the solution is simple.

Wait. That's all you need to do. Try running the Ansible playbook again in 5 minutes. This error typically happens as you try to provision a new machine that is still running the cloud init scripts used by hosts like Digital Ocean and Google.

There's more info and a Ansible task-based solution here.