Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to allow sudo without password #15

Open
mikkosuonio opened this issue Aug 5, 2016 · 3 comments
Open

Need to allow sudo without password #15

mikkosuonio opened this issue Aug 5, 2016 · 3 comments

Comments

@mikkosuonio
Copy link

The user on the target machine needs to have a right to run commands using sudo without password. Otherwise, tasks like adding Jenkins users hang silently when prompting the password in the background.

The vagrant test installation allows sudo without password, so this cannot be seen in the tests.

@noidi
Copy link
Contributor

noidi commented Aug 5, 2016 via email

@mikkosuonio
Copy link
Author

I did invoke it with --ask-become-pass, but this does not help. I still get it hanging when targetting a CI server.

When I require password for the user in vagrant, --ask-become-pass seems to help. Without it I get a clear error message showing that the sudo command fails (and proceeding as anonymous).

Maybe there is another difference in my vagrant and CI server installation. But I can proceed with the nopasswd set for the user now.

@noidi
Copy link
Contributor

noidi commented Aug 22, 2016

This is indeed an issue. Currently this role runs the Jenkins CLI as the jenkins user by calling sudo in a shell command. Here Ansible has no chance to provide the sudo password.

The better way to do this would be to use become_user on the shell tasks that invoke the Jenkins CLI. Unfortunately, as of Ansible 2.1, become_user does not work without special configuration on either the remote host or the Ansible control host.

There seems to be some light at the end of the tunnel, though. Apparently pipelining can be enabled per task and not just in ansible.cfg. I'd be willing to merge a pull request that replaces sudo with become_user and per-task pipelining.

@noidi noidi closed this as completed Aug 22, 2016
@noidi noidi reopened this Aug 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants