V
V
Vladimir Zhurkin2019-10-03 20:37:36
linux
Vladimir Zhurkin, 2019-10-03 20:37:36

How to merge multiple files into one in Ansible?

Before using Ansible was very simple. Now, in general, the same seems to be a simple thing, but how to solve it is not very clear to me.
The question, to which I have not found an answer, is it possible to somehow merge files at all?
Namely, take one file another file (third, fourth + n) and create its contents in a variable ?
You can take for example lineinfile and add / remove the necessary lines, but I wanted to take this from another file / files.
patterns? Alas, I am very unfamiliar with them.
There is another thought through the shell , the usual stupid cat.
Collect files and scatter where necessary.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Shitskov, 2019-10-03
@Zarom

https://docs.ansible.com/ansible/latest/modules/as...

O
OnYourLips, 2019-10-03
@OnYourLips

Assemble for simple cases (for example, glue public keys).
Something more complicated can be done with a script or your own module.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question