Reading through Why we use Terraform and not Chef, Puppet, Ansible, SaltStack, or CloudFormation, you should see why immutable code is so powerful.
But I would not drop Ansible altogether…
Here are some rules to look into:
- Build it immutable – cause you can the scale easily, recover easily and have a consistent source for testing and deploying what you actually tested
- Use Terraform to create immutable infrastructure setup
- Use Packer to create images that can be deployed anywhere – AWS, GCE, Vagrant, Openstack
- Use Ansible to script changes on top of your images if needed. Ansible is not immutable by itself, but allows a cleaner reusable baseline to replace your scattered scripts
- In Ansible use modules before you script, and Roles before you duplicate earlier effort. Playbooks are your scripts replacement.
More info:
https://Using Packer and Ansible to Build Immutable Infrastructure