Hi there,
I just started evaluating ansible as the means to handle a few remote systems.
Namely I’m talking about a bunch of raspberry pi’s running raspbian, which should be running pretty much the same configuration.
I find ansible very useful and powerful but I have a few doubts whether I’m using the right tool or not, or just using it the wrong way.
a) Is there any way to track the output/progress of running tasks?
Some operations like the ones performed by the apt module might take an extremely long time to run and it would be nice to be able to see what’s going on as it happens.
b) I was also wondering if there’s any way to “undo” a certain playbook, or at least a given execution.
I understand modules have a way of telling whether their execution “touched” the system or not, so it shouldn’t be impossible to save that status information somewhere (e.g. the existing version of the file) so to be able to apply it in reverse at a later stage.
Hi Brian,
thank you for your feedback.
For b), you mean logging the output? How could I do that? Would that also include e.g. the existing version of a file being overwritten?
b) can mean many things, depending on what you want.
For example, most 'file alteration modules' have a backup option to
preserve the file before the alteration.
Some also support the 'diff' option that returns a 'patch' of
before/after the change.
You can always 'register' the results and then write that to a log, or
enable a callback that does this automatically.
There are many options, it mostly depends on exactly what you want.
I see. But that means acting at the developer level, not bare "user", right?
I mean, in order to do that I'll have to write some python code, correct?
Could you please point out where to start looking in the documentation?
Thanks again, that's a very interesting insight!
Depends, in many cases you can use existing features (the backup
option), it is mostly depending on what you specifically want to do.
I'm not sure i can direct you to specific docs as what you ask is very
general. I would got at least through the introduction in https://docs.ansible.com/ansible
and then look at the playbook/playbook special topics sections to get
more in depth into some of the options.