Ansible internally uses SSH Commands to run on the target machine . Is there a way to log the commands that are being executed ?
Set the log file to use inline or in Ansible config, then run ansible-playbook with verbose option:
ANSIBLE_LOG_PATH="ansible-$(date +%Y%m%d%H%M%S).log" \ ansible-playbook -vvvv \ --diff \ -i inventory/myinventory \ myplaybook.yml
ANSIBLE_LOG_PATH- is an environment variable that maps to the
log_pathconfiguration 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