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.
More on Fundamentals and Architecture
What is Ansible and what problem does it solve?BeginnerWhat does "agentless" mean in Ansible?BeginnerWhat are the requirements for the control node?BeginnerWhat does a managed node need?BeginnerIs Ansible push-based or pull-based?BeginnerWalk through what happens when you run `ansible-playbook site.yml`.Intermediate