Desired State, Not Step-by-Step Scripts
Why declarative beats imperative.
Describe the End, Not the Steps
Ansible is declarative: you describe the end state you want, and Ansible figures out the steps to get there from wherever the host is now.
The Imperative Way
An imperative script lists exact commands in order. It assumes the starting state, so it breaks if the host is already partly set up.
apt-get update
apt-get install -y nginx
systemctl start nginxAll lessons in this course
- Desired State, Not Step-by-Step Scripts
- Reading changed vs ok in Output
- Why command Breaks Idempotency
- Check Mode: Dry-Run with --check