rvm / rvm1-ansible

The official ansible RVM role to install and manage your Ruby versions.
MIT License
271 stars 136 forks source link

sudo is deprecated - switch to become #86

Closed udondan closed 8 years ago

udondan commented 8 years ago

When running a play which uses the rvm role this warning is shown:

TASK [rvm_io.rvm1-ruby : include] **********************************************
[DEPRECATION WARNING]: Instead of sudo/sudo_user, use become/become_user and make sure become_method is 'sudo' (default). This feature will be removed in a future release. Deprecation warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.

Docs for privilege escalation

nickjj commented 8 years ago

Thanks. This role hasn't been tested against Ansible 2.x yet.

Do you know if the new syntax is backwards compatible? My concern would be swapping things around and then everyone still using 1.x would be dead in the water.

udondan commented 8 years ago

It is now tested by me. :) Though not all features. I use this role as a dependency in one of my role like this:

galaxy_info:
  dependencies: &dep
    - name: rvm_io.rvm1-ruby
      src: rvm_io.rvm1-ruby
      version: v1.3.7
      tags:
        - rvm
      become: yes
      rvm1_rubies:
        - ruby-2.2.1
dependencies: *dep

Other than the warning I didn't have any issues.

become is available since, I think, Ansible 1.9, so even folks who still use Ansible 1 could use the role with become. In fact, there was a problem in 1.9.x, since become was introduced. If one was using become on the role level (like in my example above) or on playbook level, Ansible would break and complain that become and sudo was mixed. So before I was forced to use sudo instead of become. This problem now is gone in Ansible 2 and only this warning is shown.

Ansible 2 is mostly backwards compatible. The syntax is completely the same. I have read they had changed how to use loops. Something like this:

with_items: rvm1_rubies

should rather be written as:

with_items: "{{ rvm1_rubies }}"

I updated that in my roles just to be on the safe side but actually the old notation was working as well.

I discovered a few bugs but as far as I can see you're not using the related modules or features.

You can get an overview of the changes in this video: https://www.ansible.com/webinar-on-demand-ansible-2 - I think this might have been where I read the change regarding loop-notations. Also, here is a note about the Ansible 2 release, containing some known issues: https://www.ansible.com/blog/ansible-2.0-launch.

ilyapoz commented 8 years ago

+1 works with ansible 2.0.1.0 with deprecation warnings

nickjj commented 8 years ago

Thanks for the updates.

lpaulmp commented 8 years ago

I'm closing this issue as the last week was merged https://github.com/rvm/rvm1-ansible/pull/85 which resolve this.