In check mode, I want to display the current commit in the server. I'm using the shell command (git rev-parse HEAD
) to register the variable and then print/debug it but ansible skips shell commands in check mode.
Is there anyway to mark a shell command as safe to run in check mode?
Or any ansible module to do what I want? I checked into git's module but it only looks like it does checkouts.
Any input would be appreciated.
Starting from Ansible 2.2, the right way to do it is to use check_mode: false
:
- name: this task will make changes to the system even in check mode
command: /something/to/run --even-in-check-mode
check_mode: false