Interview Prep/Ansible/Fundamentals and Architecture

Walk through what happens when you run `ansible-playbook site.yml`.

IntermediateConceptFundamentals and Architecture
Answer
  1. Ansible loads ansible.cfg, the inventory, and parses the playbook (variables, imports, roles).
  2. For each play it resolves the host pattern against the inventory and applies serial/forks batching.
  3. It gathers facts (unless gather_facts: false) by running the setup module on each host.
  4. For each task, in order, it builds a module payload, copies it to a temp dir on the target, runs it with the discovered Python, reads the JSON result, and removes the temp files.
  5. Handlers notified by changed tasks run at the end of the play (or at meta: flush_handlers).
  6. The PLAY RECAP summarises ok/changed/failed/unreachable per host.
All Ansible questions Roadmap: Ansible

More on Fundamentals and Architecture