nylas / ansible-test

An Ansible Testing Framework for Humans
MIT License
171 stars 28 forks source link

ansible has deprecated 'sudo', use 'become' #5

Open SJLC opened 8 years ago

SJLC commented 8 years ago

Fixes nylas/ansible-test#2

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

spang commented 8 years ago

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?

SJLC commented 8 years ago

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.