nbering / terraform-provider-ansible

"Logical" provider for integrating with an Ansible Dynamic Inventory script.
https://nbering.github.io/terraform-provider-ansible/
Mozilla Public License 2.0
329 stars 64 forks source link

Run ansible as part of Terraform rollout #36

Closed DanielMSchmidt closed 3 years ago

DanielMSchmidt commented 3 years ago

This is probably out of scope for this project but I wanted to explore this idea:

Could we add this feature to the provider:

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

resource "ansible_provisioning" "web" {
  hosts = [ansible_host.example]
  galaxy_roles = file("${path.module}/requirements.txt")
  playbook = file("${path.module}/web.yaml")
}

If one uses a reference to the cloud resource as input for ansible_host the ansible provisioning could be deferred until the resource is up.

Feel free to close if this is way out of scope :)

nbering commented 3 years ago

Addressed in duplicate, #35.