How to run a shell command in ansible's check mode?

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.

Answers


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


Need Your Help

My BaseController Redirect::action is being ignored

php laravel controller

In my BaseController (The default one which has that setupLayout function in it) I have a construct that checks for authentication... Because every page must be logged in to use it:

How to declare a global class object in order to make accessible from all source files

stack global extern

How to declare a global class object in order to make accessible from all source files I created a template class

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.