Oddity with alternatives module in Ansible 1.9.4?

Hi all,

I was trying to use the alternatives module to set up a new version of Ruby with Ansible 1.9.4 (both ends), and ran into problems.

I used the apt module to uninstall Ruby 2.1 and to install Ruby 2.2. Then, I wanted to make sure that 2.2 was the default for /usr/bin/ruby, /usr/bin/gem, and /usr/bin/rake. However, the alternatives symlinks don’t seem to get created.

Here’s an example of an ad-hoc command I’m running:

23:41 $ ansible ‘tag_Stages_preproduction:&tag_app_true’ -m alternatives -a ‘name=ruby path=/usr/bin/ruby2.2 link=/usr/bin/ruby’ --sudo

52.91.69.251 | success >> {

“changed”: false

}

But if I go to that server and look, /usr/bin/ruby isn’t there.

Wades-WeaveUp-Mac:~ minter$ ssh 52.91.69.251 ls /usr/bin/ruby

ls: cannot access /usr/bin/ruby: No such file or directory

If I run the update-alternatives command that I think the module does by hand, it does work.

root@preprod-app01:~# update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby2.2 0

root@preprod-app01:~# /usr/bin/ruby --version

ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux-gnu]

Am I missing something here?

–Wade

What operating system are you running on your target system?

-Toshio

The target OS is Ubuntu 14.04.

Thanks,
Wade