Ravindra BagaleCourses & study guides

Chapter 17: Interview Questions and Job Readiness

17.7 Ansible and Terraform

Q34. Ansible vs shell scripts?

Ansible aims for idempotent, inventory-driven configuration with modules and playbooks; scripts often imperative one-offs. Both can automate — Ansible scales multi-host config better.

Q35. What is inventory?

The list of hosts/groups Ansible manages (IPs/names, variables).

Q36. Terraform vs Ansible?

Terraform provisions cloud resources (desired infra state). Ansible configures OS/apps. Teams often use both.

Q37. Why run terraform plan before apply?

See add/change/destroy before mutating the cloud. Read destroy lines carefully.

Q38. Why not commit terraform.tfstate?

May contain sensitive data and is the source of truth for ownership — use remote state later; gitignore local state.

Q39. What is desired state?

You declare what should exist; the tool converges reality toward that declaration.