You need an inventory of all EC2 instances turned into an Ansible dynamic inventory. Python script or plugin?
BeginnerScenarioKubernetes, Docker, SSH & fleet automation
Answer
Situation read → Ansible already ships this.
What I'd do →
- Use the
amazon.aws.aws_ec2inventory plugin withkeyed_groupson tags andfilters. - Only write a custom script if the source is something without a plugin (a CMDB API), outputting JSON with
_meta.hostvarsfor--list.
Why → The maintained plugin handles pagination, caching and regions.
Interview tip → Knowing the plugin exists is the point.
More on Kubernetes, Docker, SSH & fleet automation
You need a report of every pod in the cluster with no CPU or memory limits. How do you write it?BeginnerYou are asked to write a small operator-like script that adds a label to every new namespace. How do you approach it?AdvancedYou need to restart all Deployments in a namespace that reference a rotated Secret. How?AdvancedYour CI runners keep running out of disk because of Docker images. Write a cleanup plan in Python.IntermediateYou need to run `df -h` on 300 Linux hosts and list any above 85%. Python or Ansible?BeginnerA Python script SSHes to hosts with `AutoAddPolicy`. Security says that is unacceptable. What do you change?Intermediate