What to do when sudo password prompt is hidden

56 views
Skip to first unread message

Alex Scoble

unread,
Oct 30, 2014, 12:44:45 PM10/30/14
to ansible...@googlegroups.com
I'm using Ansible to do an ad-hoc command against multiple systems. The command does a wget and then pipes to sudo sh. Obviously, I'm using the shell module to do this.

Psuedo command: ansible group -B 1800 -P 30 -m shell -a 'wget -O - http://some.url.com | sudo sh' --ask-pass --sudo --ask-sudo-pass

Problem is that sometimes, when this is done, sudo password prompt is hidden until user hits enter on keyboard.

How can I get Ansible beyond this issue?

Thanks,

Alex

Brian Coca

unread,
Oct 30, 2014, 1:12:21 PM10/30/14
to ansible...@googlegroups.com
you don't need the sudo in the command line, which is probably causing the issue.

*cringe* at running script from the web as root *cringe*

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/2f96a71c-21d1-4a08-a734-4d3cc8afda73%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Brian Coca

Alex Scoble

unread,
Oct 30, 2014, 1:26:11 PM10/30/14
to ansible...@googlegroups.com
One solution is to do this instead:

ansible group -B 1800 -P 30 -m shell -a 'wget -O /tmp/dosomething http://some.ur.com/somefile && ls -l /tmp/dosomething && sudo /bin/bash /tmp/dosomething' --ask-pass --sudo --ask-sudo-pass

Not sure why doing it the other way sometimes has the prompt issue.

Alex

Brian Coca

unread,
Oct 30, 2014, 1:28:58 PM10/30/14
to ansible...@googlegroups.com
With && the things get executed sequentially, with  | they get executed almost synchronously, so it has a race condition between your explicit sudo and the sudo ansible runs being fed the password before your's prompts for it.

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Brian Coca

Alex Scoble

unread,
Oct 30, 2014, 1:29:08 PM10/30/14
to ansible...@googlegroups.com
Oh, yeah, dumb mistake.

And it's not from the "web", it's from an internal package source that just happens to be a web site.

Thanks,

Alex

On Thursday, October 30, 2014 9:44:45 AM UTC-7, Alex Scoble wrote:

Brian Coca

unread,
Oct 30, 2014, 1:34:33 PM10/30/14
to ansible...@googlegroups.com

On Thu, Oct 30, 2014 at 1:29 PM, Alex Scoble <bloggi...@gmail.com> wrote:
Oh, yeah, dumb mistake.

And it's not from the "web", it's from an internal package source that just happens to be a web site.


Now I'll sleep a bit better.

--
Brian Coca
Reply all
Reply to author
Forward
0 new messages