Hi,
Is there a way to execute Ansible playbooks in Terraform main.tf file? For example I want to deploy nginx webserver inside GCP GCE VM Instance using Ansible playbook once GCP GCE VM Instance is provisioned using Terraform.
Please guide. Thanks in advance.
Best Regards,
Kaushal
Hi,
Checking in again if someone can pitch in for my earlier post to this forum. Thanks in Advance.
Best Regards,
Kaushal
Hi @kaushalshriyan,
You can use the local-exec
and remote-exec
provisioners to execute most anything you would like.
This role however is not something Terraform is well suited for, since it cannot control the provisioning done by external tools. It’s often better to use facilities native to the platform to bootstrap the services required, as most OSes have the ability to run custom startup scripts on first boot. We have some more details in the general provisioners documentation