Interview Prep/Ansible/Rolling Updates, Delegation and Orchestration

A shell command must run on localhost for each remote host, e.g. a CLI call to a cloud API.

BeginnerScenarioRolling Updates, Delegation and Orchestration
Answer

Situation read → Controller-side call per host.

What I'd do →

- ansible.builtin.command: "aws ec2 create-tags --resources {{ instance_id }} --tags Key=Patched,Value=true"
  delegate_to: localhost
  become: false

Why → become: false stops it from trying sudo on the controller.

Interview tip → Prefer the collection module over the CLI.

All Ansible questions Roadmap: Ansible

More on Rolling Updates, Delegation and Orchestration