How to run a shell command in insecure verification mode?

In check mode, I want to display the current commit on the server. I use the shell command ( git rev-parse HEAD ) to register the variable and then print / debug it, but otherwise it will skip the shell commands in check mode.

Is there any sign for a shell command as safe to run in test mode?

Or any indispensable module to do what I want? I registered with the git module, but it only looks as if it is doing checks.

Any input would be appreciated.

+6
source share
2 answers

Found the answer. You must add always_run: True to the task.

+8
source

Starting with Ansible 2.2, the correct way to do this is to use check_mode: no :

 tasks: - name: this task will make changes to the system even in check mode command: /something/to/run --even-in-check-mode check_mode: no 
+2
source

Source: https://habr.com/ru/post/986863/


All Articles