https://github.com/rasta-rocket/terraform-inventory
Generate Ansible inventory based on Terraform deployment
https://github.com/rasta-rocket/terraform-inventory
ansible go openstack terraform
Last synced: about 1 month ago
JSON representation
Generate Ansible inventory based on Terraform deployment
- Host: GitHub
- URL: https://github.com/rasta-rocket/terraform-inventory
- Owner: rasta-rocket
- License: gpl-3.0
- Created: 2017-10-29T15:24:20.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-05-30T18:06:14.000Z (about 7 years ago)
- Last Synced: 2025-01-07T15:01:27.420Z (over 1 year ago)
- Topics: ansible, go, openstack, terraform
- Language: Go
- Size: 41 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Terraform Inventory
Terraform Inventory is a tool that generate an Ansible inventory based on a Terraform deployment.
### Installation from binary
You can download the released [binaries](https://github.com/rasta-rocket/terraform-inventory/releases) and put it in your system PATH.
```
$ wget https://github.com/rasta-rocket/terraform-inventory/releases/download//terraform-inventory_linux_x64.tar.gz
$ tar -xzf terraform-inventory_linux_x64.tar.gz
$ sudo cp terraform-inventory /opt
$ export PATH=$PATH:/opt
$ terraform-inventory --help
```
### Installation from source
[Go 1.11.x](https://golang.org/) is required to build this tool.
Then fetch terraform-inventory from github sources.
```
$ git clone https://github.com/rasta-rocket/terraform-inventory
$ go build
```
### Usage
Basic usage:
```
$ terraform apply
$ terraform-inventory -u -k
? Choose a bastion :
❯ e1b52c07-8a75-4527-b43f-850aaec4c3ef bastion_0 172.16.1.23
Inventory file is configured with 172.16.1.23 as bastion (ssh-proxy)
$ cat hosts
$ ansible -m ping all
```
You can also force the bastion IP you want to use:
```
$ terraform apply
$ terraform-inventory -u -k --bastion 172.16.1.25
Inventory file is configured with 172.16.1.25 as bastion (ssh-proxy)
$ cat hosts
$ ansible -m ping all
```