If a situation arises where you need to keep secret data but at the same time share it publicly as well, use Vault in playbooks. However, if you’re using -v (verbose) mode and don’t want it to be seen by anyone, then you can use:
name: secret task
shell: /usr/bin/do_something --value={{ secret_value }}
no_log: True