Categorygithub.com/pimsmath/ansible-terragrunt-inventory
repositorypackage
0.4.0
Repository: https://github.com/pimsmath/ansible-terragrunt-inventory.git
Documentation: pkg.go.dev

# README

ansible-terragrunt-inventory

A dynamic inventory script for Ansible and Terragrunt. This is a minor modification of ansible-terraform-inventory to use terragrunt in place of terraform.

Quickstart

To use this inventory script, you must first create Terraform resources using the terraform-provider-ansible plugin:

resource "ansible_host" "example" {
  inventory_hostname = "example.com"
  groups = ["web"]
  vars {
    ansible_user = "admin"
  }
}

resource "ansible_group" "web" {
  inventory_group_name = "web"
  children = ["foo", "bar", "baz"]
  vars {
    foo = "bar"
    bar = 2
  }
}

Next, use this script as your Ansible dynamic inventory script.

Set the TF_STATE environment variable to the directory which would contain the terraform.tfstate if the state was held locally.

Installation

Download the latest release.

Building From Source

$ go get github.com/pimsmath/ansible-terragrunt-inventory
$ go build -o $GOPATH/bin/terragrunt-inventory
$ ln -s $GOPATH/bin/terragrunt-inventory /path/to/ansible/inventory