# roster: an Ansible dynamic inventory tool for Terraform projects

**URL:** <https://forum.ansible.com/t/roster-an-ansible-dynamic-inventory-tool-for-terraform-projects/19660>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [October 30, 2015, 6:19pm UTC](https://forum.ansible.com/t/roster-an-ansible-dynamic-inventory-tool-for-terraform-projects/19660 "2015-10-30T18:19:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![george\_hartzell](https://avatars.discourse-cdn.com/v4/letter/g/958977/32.png) [@george\_hartzell](https://forum.ansible.com/u/george_hartzell)\
**Post date:** [October 30, 2015, 6:19pm UTC](https://forum.ansible.com/t/roster-an-ansible-dynamic-inventory-tool-for-terraform-projects/19660/1 "2015-10-30T18:19:46Z")

</div>

Hi All,

I’d like to share [roster](https://github.com/hartzell/roster).

Roster is a tool for working transforming Terraform state information  
into other forms (it’s original calling was as an Ansible dynamic  
inventory provider). It is intended to be “go get’able”.

I’d appreciate any feedback all y’all have to offer on go issues,  
Ansible issues and/or Terraform issues. I’m particularly interested  
in extending the set of Terraform providers it supports and making my  
go better.

It uses terraform’s routines to work with the state information, which  
seems better than reverse engineering the state files themselves. But,  
these routines are not mainstream, so we’ll have to see what happens  
going forward. More info in  
[terraform issue 3405](https://github.com/hashicorp/terraform/issues/3405).

It uses Go templates to generate it’s output. One can dump out these  
templates, e.g.:

$ ./roster dump-template /templates/dynamic-inventory

and see what it’s doing. One can also supply one’s own templates

$ ./roster execute-template myTemplate.txt

Roster parses state data for instances from:

- OpenStack
- the instance name is used as the Name
- the access\_ip\_v4 is used as the Address
- host\_vars and groups can be specified in the resource configuration  
metadata section like so:

metadata {  
ansible\_groups = “foo, bar”  
ansible\_host\_vars = “color=red, importance=high”  
}

Parsing those strings is very unsophisticated, I’m waiting for  
better use cases before I get fancy.

- DigitalOcean

- the name is used as the Name

- the ipv4address is used as the Address

- there is no support for groups or hostvars

- Cloudstack

- the name is used as the Name

- the ipaddress is used as the address

- there is no support for groups or hostvars

- AWS

- I have _preliminary_ support for AWS instances, BUT

- Every instance is named “moose”, I can’t figure out what info to use  
as the Name.

- If an instance has a public\_ip, that is used as the Address, if not  
and it has a private\_ip then that is used.

Let me know if you find it useful.

g.
