# Oddity with alternatives module in Ansible 1.9.4?

**URL:** <https://forum.ansible.com/t/oddity-with-alternatives-module-in-ansible-1-9-4/20114>\
**Category:** Ansible Project\
**Created:** [January 4, 2016, 4:48am UTC](https://forum.ansible.com/t/oddity-with-alternatives-module-in-ansible-1-9-4/20114 "2016-01-04T04:48:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![H\_Wade\_Minter](https://avatars.discourse-cdn.com/v4/letter/h/f05b48/32.png) [@H\_Wade\_Minter](https://forum.ansible.com/u/H_Wade_Minter)\
**Post date:** [January 4, 2016, 4:48am UTC](https://forum.ansible.com/t/oddity-with-alternatives-module-in-ansible-1-9-4/20114/1 "2016-01-04T04:48:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Toshio\_Kuratomi](https://avatars.discourse-cdn.com/v4/letter/t/41988e/32.png) [@Toshio\_Kuratomi](https://forum.ansible.com/u/Toshio_Kuratomi)\
**Post date:** [January 5, 2016, 2:40pm UTC](https://forum.ansible.com/t/oddity-with-alternatives-module-in-ansible-1-9-4/20114/2 "2016-01-05T14:40:23Z")

</div>

What operating system are you running on your target system?

-Toshio

---

<div class="post-metadata">

**Author:** ![H\_Wade\_Minter](https://avatars.discourse-cdn.com/v4/letter/h/f05b48/32.png) [@H\_Wade\_Minter](https://forum.ansible.com/u/H_Wade_Minter)\
**Post date:** [January 5, 2016, 2:56pm UTC](https://forum.ansible.com/t/oddity-with-alternatives-module-in-ansible-1-9-4/20114/3 "2016-01-05T14:56:17Z")

</div>

The target OS is Ubuntu 14.04.

Thanks,  
Wade
