Shell pre check command

When working with tools that don’t have an Ansible module/roles and only have shell commands to interact with. I find my self writing the following:

  • shell: pre_check_command || command

Where ‘pre_check_command’ exits with 0 if the outcome of ‘command’ already exits. Unfortunately, such usage will always output [changed].

I know I can use multiple tasks with register and chagned_when, but it feels like a lot lines for something that is common.

Anyone else seeing the same pattern when working with the shell module?
Perhaps an additional argument for the shell module or is there an entirely different trick that I’m not seeing?