βΆAnsible vs Terraform β when do I use each?
Ansible: configuration management, application deployment, orchestration. Iterative, mutable infrastructure. Terraform: infrastructure provisioning, immutable desired state, AWS/Azure/GCP resource management. Modern DevOps uses both: Terraform provisions instances, Ansible configures them. They complement, not compete.
βΆHow is Ansible agentless different?
Ansible connects via SSH (Linux) or WinRM (Windows) β no agent to install, no background service running. Competitors (Puppet, Chef) install agents that phone home. Agentless = less operational overhead, easier onboarding, better security (no persistent agent). Trade-off: slightly slower for massive-scale ops (100k+ nodes).
βΆWhat's idempotency and why does it matter?
Running a playbook twice = same result as running it once. If a package is installed, re-running doesn't reinstall. If a config file is correct, no change. Idempotency = safe automation; ops can re-run playbooks without breaking production. Ansible modules are idempotent by design.
βΆAnsible Tower vs AWX vs Ansible Automation Platform β what's the difference?
AWX (open-source, free, community-supported): UI, RBAC, scheduling, webhooks. Tower (legacy, deprecated): commercial, replaced by AAP. Ansible Automation Platform (AAP, modern): Red Hat's commercial offering with support, advanced analytics, hub integration. For enterprises: AAP. For labs/small orgs: AWX. AWX is fine for most use cases.
βΆHow do I manage secrets in Ansible?
Ansible Vault encrypts sensitive data (passwords, API keys) in playbooks. Store vault password in `.vault_password` file or pass via `--vault-password-file`. For teams: use HashiCorp Vault integration. Never commit secrets to Git; use CI/CD to inject at runtime.
βΆWhat's the difference between plays, tasks, handlers, and roles?
Play: collection of tasks targeting a host group. Task: single action (install package, restart service). Handler: task triggered by notify (only runs if something changed). Role: reusable, organized bundle of tasks, handlers, templates, variables. Roles = best practice for scaling.
βΆCan Ansible manage cloud infrastructure like AWS?
Yes, via modules: aws_ec2, rds, s3, etc. Ansible provisioning < Terraform (Terraform is cloud-native). Use Ansible for post-deployment config, app setup. Use Terraform for resource provisioning. Together: Terraform spins up, Ansible configures.