1
1
mirror of https://github.com/adammck/terraform-inventory synced 2024-11-23 00:12:13 +01:00
terraform-inventory/README.md

47 lines
1.2 KiB
Markdown
Raw Normal View History

2014-09-19 23:34:41 +02:00
# Terraformed Inventory
2014-09-24 20:47:37 +02:00
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.
2014-09-25 00:54:39 +02:00
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
2014-09-24 20:47:37 +02:00
2014-09-25 00:54:39 +02:00
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:
2014-09-24 20:47:37 +02:00
#!/bin/bash
2014-09-25 00:54:39 +02:00
terraform-inventory $@ deploy/terraform.tfstate
2014-09-24 20:47:37 +02:00
2014-09-25 00:54:39 +02:00
Then run Ansible with the script as an inventory:
ansible-playbook --inventory-file=bin/inventory deploy/playbook.yml
2014-09-19 23:34:41 +02:00
## Development
2014-09-24 20:47:37 +02:00
[Install Terraform] [tfdev] from source, then:
2014-09-19 23:34:41 +02:00
git clone https://github.com/adammck/terraform-inventory.git
cd terraform-inventory
2014-09-19 23:34:41 +02:00
go build
## License
MIT.
[ansible]: http://www.ansible.com
[tf]: http://www.terraform.io
[tfdev]: https://github.com/hashicorp/terraform#developing-terraform