Hi All,
I’d like to share 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.
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.