Interview Prep/Ansible/Fundamentals and Architecture

What does "declarative" mean in the context of Ansible, and is Ansible fully declarative?

IntermediateConceptFundamentals and Architecture
Answer

Declarative means you state the end result ("package nginx is present, service is started") and the module works out what to do. Well-written modules check current state first and only change what differs.

Ansible is not purely declarative: playbooks execute top to bottom, and shell/command tasks are imperative. So it is a hybrid, declarative at the module level and procedural at the playbook level. This is different from Terraform or Puppet, which build a dependency graph.

All Ansible questions Roadmap: Ansible

More on Fundamentals and Architecture