Playbook fails to install package due lack of sudo, even when package is already installed
danielporto opened this issue · 9 comments
I'm running the playbook in a server where I dont have sudo access but all dependencies
of sdkman role are installed (I tried apt install each one of them)
Is there a way to test if the package exists before installing and prevent the spurious error message?
Despite all packages are installed I got the following error message:
TASK [comcast.sdkman : Install system packages] *******************************************************************************************************************************
failed: [client1] (item=curl) => {"changed": false, "item": "curl", "module_stderr": "sudo: a password is required\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 1}
failed: [client1] (item=debianutils) => {"changed": false, "item": "debianutils", "module_stderr": "sudo: a password is required\n", "module_stdout": "", "msg": "MODULE FAILUR
E", "rc": 1}
failed: [client1] (item=findutils) => {"changed": false, "item": "findutils", "module_stderr": "sudo: a password is required\n", "module_stdout": "", "msg": "MODULE FAILURE",
"rc": 1}
failed: [client1] (item=tar) => {"changed": false, "item": "tar", "module_stderr": "sudo: a password is required\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 1}
failed: [client1] (item=unzip) => {"changed": false, "item": "unzip", "module_stderr": "sudo: a password is required\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 1}
failed: [client1] (item=zip) => {"changed": false, "item": "zip", "module_stderr": "sudo: a password is required\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 1}
Interesting edge-case! The way I determined those dependencies to begin with was to basically play "whack-a-mole" until each of the utilities expected by the sdk
functions were present. It should be possible to conduct those tests prior to installing the packages.
For my sanity, please add the following to this issue:
- Local OS/version
- Remote OS/version
- Local Ansible version
- Local Python version
Thanks!
"For my sanity, please add the following to this issue:"
Sure! Here is it:
Local OS/version: MacOS/10.13.6
Remote OS/version: centos7/kernel 4.14
Local Ansible version: ansible 2.6.5
Local Python version: python version = 2.7.15
Thanks!
@danielporto Does the rest of the role work for you if you disable privilege escalation for that particular step? If setting become: no
during that step solves the problem, I think we'll just need to add a check for the existence of those packages that doesn't require privilege escalation.
@elliotweiser -- I think you meant @danielporto ?
I'm not sure if I understand the question.
the default setting on my playbook is become: no
the few post-tasks are done in user's home profile, so there should be no problem.
sdk is also downloaded to a folder where user can read/write (within its home dir).
I use to have private jdk installations (like bundles) for my deployments. Therefore, admin privileges are not required at all.
it's that what you mean?
@danielporto Let me clarify my earlier question:
Does the rest of the role work for you despite the lack of sudo permissions when installing packages? What if you commented out the portion of the install.yml
that installs the system packages? Is there anything else you'd need to be handled for this edge-case?
Got it.
I will try and let you know.
On closer inspection, I think it's possible to limit the amount of privilege escalation used during this role. Most of these steps can happen in user-space without sudo
. I'll look into fixing this shortly.
@danielporto See https://github.com/Comcast/ansible-sdkman#additional-notes. Change was released in 1.4.2