record remote SSH session of Ansible as a commands transcript

Debian upgrade instructions contain very useful advice - record shell session
of upgrade process with screen:

It is strongly recommended that you use the /usr/bin/script program to record a transcript of the upgrade session. Then if a problem occurs, you will have a log of what happened, and if needed, can provide exact information in a bug report. To start the recording, type:

script -t 2>~/upgrade-wheezy*step.time -a ~/upgrade-wheezystep*.script

Is it possible to record invisible Ansible session in the same way? That would
be a killer feature that help people to understand how certain playbook work
and enhance Ansible on the way.

Why I think it is possible? Because Ansible uses only SSH only, and
everything you type in SSH can be recorded.

Ansible doesn’t “type” in SSH, but actually transfers and executes modules.

Thus the playbook is the best indication of what you are intending to do, and what you did.

Ok. That clarifies it a bit, but even if so, the output is only captured on demand,
and the sequence of actual transfer and execute commands is not visible. Is it
possible to dump in a human readable manner? playbook is a good plan
overview, but not always what really happens.

“Ok. That clarifies it a bit, but even if so, the output is only captured on demand,
and the sequence of actual transfer and execute commands is not visible”

That’s not entirely true. Check out -vvv.

You can use -vvv (or -vvvv for full ssh debugging) as well as ANSIBLE_LOG_PATH=file. More v's will show you more interaction, and the log path will record everything for review at a later time.

-jlk

Great. Just what I need. Thanks.