Interview Prep/Python for DevOps/Kubernetes, Docker, SSH & fleet automation

You need to compare installed package versions across 100 servers to find drift. How?

BeginnerScenarioKubernetes, Docker, SSH & fleet automation
Answer

Situation read → Fleet query plus diff.

What I'd do →

  1. Collect rpm -qa --qf '%{NAME} %{VERSION}-%{RELEASE}\n' or dpkg-query -W via Fabric/SSM.
  2. Parse into {host: {pkg: version}}, find packages whose version set across hosts has more than one value.
  3. Output a CSV of package, versions and host counts.
  4. Long term: immutable images (AMIs/containers) so drift cannot happen.

Why → Drift detection points to the real fix: immutable infrastructure.

Interview tip → End with immutability.

All Python for DevOps questions Roadmap: Python for automation

More on Kubernetes, Docker, SSH & fleet automation