geerlingguy/ansible-role-ruby

Updating ruby version does not work.

iuri-gg opened this issue · 5 comments

I used role to install ruby from source on a given machine. Later, I changed ruby version/url to a newer release and re-ran the role against the machine. I was expecting new version of ruby to be installed on the system. However role skips installation of ruby from source if there is any ruby already present on the system.

Is this an expected and correct behaviour for the role? If not, I can try to fix it and submit a PR for it.

Thanks,
Iuri

j15e commented

You may remove the creates=/usr/local/bin/ruby line here :

- name: Build ruby.
command: >
{{ item }}
chdir={{ workspace }}/ruby-{{ ruby_version }}
creates=/usr/local/bin/ruby
with_items:
- ./configure --enable-shared
- make
- make install

But please note that this will ALWAYS compile & install ruby, so this is not perfect either.

We would need a way to know that the specific version of ruby was already compiled & installed, but the output file is always the same (/usr/local/bin/ruby). Would need to check the checksum of the files but I don't know how to do this simply with the Ansible language.

You don't have to check the checksum; you can parse the output of ruby -v to see if it matches what the user has set as the Ruby version. This would be really helpful for me, as I often need to update the version of Ruby on provisioned servers... Will see if I have time to assemble a PR for this.

stale commented

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

stale commented

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.