A Terraform provider serving as an interop layer for an Ansible dynamic inventory script.
Read the introductory blog post for an explanation of the design motivations behind this provider.
Installation can be accomplished in two different ways:
- Installing a pre-compiled release (recommended)
- Compiling from source
Downloading and installing a pre-compiled terraform-provider-ansible
release
is the recommended method of installation since it requires no additional tools
or libraries to be installed on your workstation.
-
Visit the releases page and download the latest release for your target architecture.
-
Unzip the downloaded file and copy the
terraform-provider-ansible
binary to a designated directory as described in Terraform's plugin installation instructions.
Note: Terraform requires Go 1.9 or later to successfully compile.
If you'd like to take advantage of features not yet available in a pre-compiled
release, you can compile terraform-provider-ansible
from source.
In order to compile, you will need to have Go installed on your workstation. Official instructions on how to install Go can be found here.
Alternatively, you can use gimme as a quick and easy way to install Go:
$ sudo wget -O /usr/local/bin/gimme https://raw.githubusercontent.com/travis-ci/gimme/master/gimme
$ sudo chmod +x /usr/local/bin/gimme
$ gimme 1.10
# copy the output to your `.bashrc` and source `.bashrc`.
Once you have a working Go installation, you can compile
terraform-provider-ansible
by doing the following:
$ go get github.com/nbering/terraform-provider-ansible
$ cd $GOPATH/src/github.com/nbering/terraform-provider-ansible
$ make
You should now have a terraform-provider-ansible
binary located at
$GOPATH/bin/terraform-provider-ansible
. Copy this binary to a designated
directory as described in Terraform's plugin installation instructions
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
}
}
A Terraform Provisioner that runs Ansible-Local on a target machine at creation-time.
A very similar solution to this one, without the Logical provider. Depends on specific Terraform resource types, and relies heavily on cloud-providers' tag implementations.
An Ansible module that runs Terraform plans and deployments.
Contributions specific to this project are made available under the Mozilla Public License.
Code under the vendor/
directory is copyright of the various package owners,
and made available under their own license considerations.