ansible-test icon indicating copy to clipboard operation
ansible-test copied to clipboard

ansible has deprecated 'sudo', use 'become'

Open SJLC opened this issue 9 years ago • 2 comments

Fixes nylas/ansible-test#2

Migrate from ansible's pre-1.9 privilege escalation mechanism to the current mechanism:

  • Switch 'sudo:' to 'become:' in playbook
  • Remove '-s' from ansible-playbook command-line

SJLC avatar May 03 '16 08:05 SJLC

Thanks for contributing! Does this break compatibility with ansible < 1.9? Is there a way we can fix this for 1.9 without breaking backcompat?

spang avatar May 25 '16 22:05 spang

Maybe...

There could be some check on ansible_version to pick whether to execute 'sudo' or 'become' version, though the check on ansible_version wouldn't distingish between a really old version and ansible 2.0 due to a bug ( https://github.com/ansible/ansible/issues/11545 )

On the other hand, ansible 2.0 has the 'sudo' backwards compatibility working again, unlike 1.9 ( https://github.com/nylas/ansible-test/issues/2 ), so perhaps the policy could be to use sudo if ansible_version < 1.9 or ansible_version undefined.

On the third hand, is backward compatibility even useful in this specific instance? ansible-test uses pip to install ansible, not the package manager, and without locking it to a specific version. Thus the newest stable ansible is always used for tests, and nowadays that is never going to be a version that lacks 'become' support.

So do you want to uglify things for a situation that won't be encountered with the current install strategy? If not, I could just re-base what's here now.

SJLC avatar May 26 '16 08:05 SJLC