There is something similar to playbook in Ansible?

Hi,
I know Terraform, but not Ansible, I would love to know if there is anything similar to the Ansible playbook in Terraform.
(I want to write in terraform)
Thank you,

No, there isn’t.

In Ansible, the user writes a list of things to check or do, in a given order.

In Terraform, the user writes a definition of the intended final state, and figuring out what to do to get there, and what order to do it in, is entirely up to Terraform.

So there is no concept similar to a playbook.

Thank you!
My problem I got this instruction:

Create an ansible playbook that will deploy a docker-compose application containing two > services:

  1. Web server that will offer a basic “Hello World” HTML page.
  2. Stateful service that will keep a counter-hit from the web server in a separate DB container.
    thanks!

And I said I would do it in Terraform, can you maybe recommend me how I can do it? Or send me a link with an example?

I don’t understand this instruction… isn’t deploying a docker-compose application just a matter of running docker-compose up ?

For such a simple task, what is there for either Ansible or Terraform to contribute to the solution?

I do not know … it’s a task I have to perform :slight_smile: If it’s that simple - I’d be happy if it would be possible to guide me on how to do it …
Thank you!

If I was given this task, I would return to the instructor or manager, and request clarification, as the requirements as given do not appear to make sense.

Hi @Frida!

I think most of us working in this field can empathize with the situation of being given some very broad requirements and having to map them to a daunting and seemingly-infinite space of possible solutions. :grimacing:

Unfortunately, I don’t think the participants in this forum will be able to be of direct help to you at the current phase of your planning process, since it seems that you are still at the phase of gathering requirements and learning about various different competing options, rather than at a point where you’ve already selected Terraform as the tool to use and have questions about some details about how to use it.

To elaborate on what @maxb said, I think in similar situations I would aim to answer the following questions as some first steps:

  • Are there any hard requirements being imposed on you by stakeholders? For example, if your organization already has a relationship with a particular vendor then their policy may require you to use the services of that vendor even if another vendor’s services/solutions may be a better from a technical standpoint. In other words, the decision might be “made for you”, as much as that can be a frustrating situation to be in.

  • Is there existing precedent in your organization for solving similar problems in a particular way? If so, can those who created that predecent provide advice on whether that precedent applies to your new requirements, and if so how you might best employ the existing patterns?

  • If the previous question doesn’t narrow down to one particular path, can you at least find a “shortlist” of a few different options to consider?

    When considering those options, I would typically want to think not only about what the different technology solutions can do but also what it would take to adopt and support those technologies within my existing organization. For example, if you have both Ansible and Terraform as seeminly-equivalent solutions from a technology-capability standpoint, but your organization already has expertise with Ansible and not Terraform, it would probably be pragmatic to choose Ansible.

If you do ultimately choose to use Terraform as all or part of the solution to this problem, I think folks in this forum would be happy to help you work out the details of it. However, with requirements as broad as what you shared so far I think you may need to make some progress trying things with Terraform yourself a bit first, and then come back to the forum if you encounter particular challenges where you can’t find a solution. In discussion forums like this, it’s often difficult to have broad discussions about possibilities but far more practical to have discussions about what might be wrong with a specific code example or what the tradeoffs might be between a few specific design ideas.

I’m sorry I can’t share anything more specific right now! At your current stage I expect that looking for resources inside your organization will be the most important thing, because the tradeoffs you need to make here are probably about more than just specific technology and rely on information that we as outsiders cannot guess.