Answer the question
In order to leave comments, you need to log in
How to write generic playbooks in Ansible?
I would like a convenient distribution of roles and auto-updates. Judging by the fact that most modules have present, latest, etc. parameters, with Ansible it is quite possible not only to quickly deploy environments, but also to keep them up to date.
When writing the first roles, I encountered such a problem that each next launch will make a new configuration. In my example, this is the configuration of the backup client, when it is initialized, a certain key is created, which should then be reported to the backup controller, and of course I do not need to generate it every time a new one. However, I could not find any more or less simple and ready-made solution.
I myself imagine it like this:
1) Run the playbook with the firstrun tag, performing such tasks only with this tag
2) Compose some kind of lock-file and check it before launching this task, the most logical solution - but somehow you need to write and invent a lot of extra stuff.
Isn't there a simpler solution?
Or should the approach be like this: write your own role/playbook for each case?
In general, I will briefly tell you in what situations do you use Ansible?
A very rich project in terms of opportunities and you can’t immediately understand how to prepare it effectively.
Thank you.
Answer the question
In order to leave comments, you need to log in
Freeze the fingyu, before generating the key, you just need to check whether they exist or not.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question