Interview Prep/Ansible/Ad-hoc Commands, Modules and Idempotency

What are the most useful options for ad-hoc and playbook runs (`-b`, `-K`, `-u`, `-f`, `-e`)?

BeginnerConceptAd-hoc Commands, Modules and Idempotency
Answer
  • -b / --become — escalate privileges (sudo by default)
  • -K — prompt for the become password
  • -u user — remote user; -k asks for the SSH password
  • -f N — forks, number of hosts handled in parallel (default 5)
  • -e "k=v" or -e @vars.yml — extra variables (highest precedence)
  • -i inventory, -l limit, -t tags, -v verbosity
ansible web -i inventory/ -b -u ubuntu -f 20 -m apt -a "upgrade=dist"
All Ansible questions Roadmap: Ansible

More on Ad-hoc Commands, Modules and Idempotency