Trouble updating alternatives on CentOS via shell/command modules

I tried using the debian-specific update-alternatives module but this did not work. Very simply, I have a command that when executed from the command line on the server itself works fine but via a task in our playbook says it succeeded but in reality has no effect.

Very simply, I am trying to do:

  • name: “Use our version of java as default command”

shell: /usr/sbin/alternatives --set java /usr/local/java/bin/java

The playbook runs as root on the remote machine so I doubt it is a permissions issue - anyone else encounter this?

alternatives module works for me, if it does not for you, could you file a bug?​