1
1
mirror of https://github.com/adammck/terraform-inventory synced 2024-11-26 07:43:46 +01:00
Terraform State → Ansible Dynamic Inventory
Go to file
2015-02-09 16:43:46 -05:00
fixtures Refactor to remove Terraform dependency 2015-02-09 16:37:30 -05:00
.gitignore Rename to terraform-inventory 2014-09-24 15:35:55 -04:00
cli_test.go Refactor to remove Terraform dependency 2015-02-09 16:37:30 -05:00
cli.go Refactor to remove Terraform dependency 2015-02-09 16:37:30 -05:00
main.go Add version info to binaries 2015-02-09 16:37:43 -05:00
parser_test.go Remove aws_instance. prefix from host names 2015-02-09 16:37:43 -05:00
parser.go Remove aws_instance. prefix from host names 2015-02-09 16:37:43 -05:00
README.md Clarify usage in README 2014-09-24 18:54:39 -04:00
version_test.go Add version info to binaries 2015-02-09 16:37:43 -05:00
version.go Add version info to binaries 2015-02-09 16:37:43 -05:00

Terraformed Inventory

This is a little Go app which generates an dynamic Ansible ansible inventory from a [Terraform] tf state file. It allows one to spawn a bunch of VMs with Terraform, then (re-)provision them with Ansible. It's pretty neat.

Usage

Just download the OSX binary and run it.

curl -L -O https://github.com/adammck/terraform-inventory/releases/download/v0.2/terraform-inventory
chmod u+x terraform-inventory
./terraform-inventory --list whatever.tfstate

Ansible doesn't (seem to) support calling the inventory script with parameters (and this tool doesn't support configuration via environment variables yet), so I like to create a little shell script and call that. Something like:

#!/bin/bash
terraform-inventory $@ deploy/terraform.tfstate

Then run Ansible with the script as an inventory:

ansible-playbook --inventory-file=bin/inventory deploy/playbook.yml

Development

[Install Terraform] tfdev from source, then:

git clone https://github.com/adammck/terraform-inventory.git
cd terraform-inventory
go build

License

MIT.