Using Ansible Shell Module to Execute Remote Commands
· via Spacelift
Summary: Shell is the escape hatch everyone uses and few use carefully. Prefer command over shell unless you need shell features, and prefer a dedicated module over both whenever one exists, since shell tasks are where idempotency goes to die. When shell is unavoidable, pair it with creates, removes or changed_when so reruns stay honest.
Who should read it: Ansible users with playbooks full of shell tasks, and reviewers deciding which of them deserve to stay.