How to log native commands run by Ansible Playbook
Set the log file to use inline or in Ansible config, then run ansible-playbook with verbose option:
ANSIBLE_LOG_PATH=&quot;ansible-$(date +%Y%m%d%H%M%S).log&quot; \
ansible-playbook -vvvv \
    --diff \
    -i inventory/myinventory \
    myplaybook.yml


ANSIBLE_LOG_PATH - is an environment variable that maps to the log_path configuration item. Sets the file to log to. When using an environment variable you can use shell substitution to add the date and time to the file name so the next run doesn't overwrite the log file.
-vvvv - be very very very verbose. Will show SSH commands executed.
--diff - bonus, when making a change show what has been done.
the rest are standard options.

The log will be in a file in the current directory named something like ansible-20200818155322.log