terraform ansible - ghdrako/doc_snipets GitHub Wiki
Terraform provider for Ansible
- https://registry.terraform.io/providers/ansible/ansible/latest/docs
- https://github.com/ansible/terraform-provider-ansible
Ansible provider for Terraform and collection
- https://www.ansible.com/blog/providing-terraform-with-that-ansible-magic
- https://www.ansible.com/blog/walking-on-clouds-with-ansible
Implementing the Ansible Provisioner
- https://github.com/ishajain140/terraform_ansible_integration/blob/main/ansi_terraform.tf
- https://github.com/ishajain140/terraform_ansible_integration/blob/main/ansi_terraform.tf
- https://medium.com/geekculture/the-most-simplified-integration-of-ansible-and-terraform-49f130b9fc8
resource "null_resource" "ansible_provisioner" {
provisioner "local-exec" {
command = "ansible-playbook -i ${self.private_ip}, playbook.yml"
working_dir = "${path.module}/ansible"
# Assuming your Ansible playbook is in a folder called 'ansible'
# within your Terraform module.
}
}
The null_resource resource is a resource that does nothing but acts as a trigger, while the local-exec resource allows running local shell commands.