Interview Prep/Ansible/AWX, Cloud and Large-Scale Operations

A play needs to destroy a test environment on schedule to save money.

BeginnerScenarioAWX, Cloud and Large-Scale Operations
Answer

Situation read → Scheduled teardown.

What I'd do →

- amazon.aws.ec2_instance:
    filters: { "tag:Env": test, instance-state-name: running }
    state: absent

Schedule the job in AWX nightly, and use a protection tag to exempt instances.

Why → Filters make it declarative and repeatable.

Interview tip → Dry-run with --check and require approval for anything tagged prod.

All Ansible questions Roadmap: Ansible

More on AWX, Cloud and Large-Scale Operations