Closed psaini79 closed 4 years ago
If you mean, to call Ansible during Terraform Apply, that would definitely not be supported by this project. I call out to Terraform to get the inventory data for the current workspace, but if you were in the middle of a Terraform Apply, your inventory would be inconsistent, or locked if your remote inventory provider supports that.
The workflow for this tool is: 1) Draft Terraform config, with hooks to store values for Ansible to use later. 2) Terraform Apply 3) Run Ansible, using Dynamic Inventory which utilizes values from your Terraform config.
I don't think there's anything blocking multiple inventory sources in Ansible, but I'm not sure if that's supported on the command-line, or if you'd have to call one of the inventory modules to add a second source. I've never tried that.
@nbering
Let me explain my requirements:
I have pre-developed ansible playbooks. These playbooks consume config files (yaml file which contains variable and their values) to start the provisioning of the Kubernetes cluster. I have a scenario where these playbooks can be called using terraform-provider-ansible as many cloud vendors use terraform in resource manager for provisioning but I am unable to identify the way to use terraform-provider-ansible to call ansible playbooks.
For example, Oracle ORM has referred terraform-provider-ansible plugin and I am not sure if this can be helpful in this scenario.
Please provide some details if it is possible or not?
I'm sorry, but I still don't follow your requirements. Are you saying that you send a Terraform template to an external tool, and then it runs Terraform for you? Like by submitting the template to an API or attaching a file to a web form?
Following-up from my last comment, I skimmed the documentation page you sent.
It seems like they've just sort of wrapped the Terraform deployment process in some sort of runner, like using Hashicorp's Terraform Cloud solution? Here's a flowchart from their own docs on how their workflow is set up.
But with Hashicorp's solution, you can still use the local CLI to run tasks, as I understand it. The paired Terraform Inventory script for Ansible requires that it can run terraform state pull
to get the remote state. If the Oracle product doesn't allow access to the state, then that would cause a conflict for the Ansible side of the tooling. It needs to be able to parse out the state data to find the hosts and their assigned variables.
While the Oracle ORM product you linked cites support for my project, I honestly have no idea how their product is used, beyond what I just skimmed. And to be honest, I still don't follow whether this is a web-based UI product, an API, some CLI tool, or something else entirely... so I can't say that I can actually provide support them. You might want to follow up with Oracle's support for this.
If you do get an answer about how to use them together, I'd be curious to learn more...
Happy to re-open if a more specific question comes up.
Hi,
I am looking for some samples where using terraform we will be calling Ansible playbooks and these playbooks use static as wells as dynamic inventory.
Please let me know if there is any such samples are available?