Skip to content

3. Why you should use anster

Justin Perdok edited this page Oct 8, 2021 · 1 revision

Why you should use anster

You might ask "Why would I want to use anster, I could just use a null_resource/provisioner in Terraform to provision my hosts?". And you would be right, but I personally think that wrapping Ansible around Terraform (instead of Terraform around Ansible, or Terraform that calls inline commands/bash scripts) gives you more options, ease of use and flexibility.

For example, with anster you can very easily reapply a playbook/role without having to taint/recreate a resource in Terraform since all the configuration is kept separate from Terraform. You also don't need to worry that you might overwrite or break things since Ansible is idempotent.

anster also gives you the ability to define your infrastructe in a simple Ansible dictonary that supports the use of Ansible Inventory groups, making it easier to apply tasks/playbooks/roles in bulk to specific groups of hosts without having to create separate Terraform resources/modules for each type of host/build logic around type of hosts.

The only downside to wrapping Ansible around Terraform is that you need to parse the Terraform output to build a Ansible inventory file, but anster does this for you 😄 (for the providers that it supports).

anster also includes some useful playbooks and tasks, such as the ability to automagicly install Ansible roles/collections from a requirements.yml or the minimal/sane bootstrap that is applied to all host when they are created (Thanks to robertdebock for his amazing and easy to use collection of roles).

Clone this wiki locally