delete a remote file

What is the proper way to delete a remote file. Example: If I’ve used Ansible to copy a file to a remote server, how do I delete it from ansible?

I’ve looked in the docs, googled it, tried using the shell command with rm, also with src= removes=True; I’ve tried the same in command, I’ve even tried file: path=~/ state=absent

I’m getting no errors, but when I go check the remote server, the file is still there.

regards, Richard

Your file command is the correct one to use, just note that
path=~/<filename> will depend on the remote user. try using the full
path when in doubt.

Brilliant, thanks!