[CentOS] use pssh to restart a service

Mon Nov 2 01:35:17 UTC 2015
Tim Dunphy <bluethundr at gmail.com>

Hey Gordon,

 Sorry, man my bad! Disabling the tty requirement for my sudo user does
indeed work. I had a type-o in the sudoers file, and when I corrected it,
my sudo command via pssh started working!

#pssh -i -h es_list "/bin/sudo  /bin/systemctl restart elasticsearch; sleep
10"
[1] 20:31:32 [SUCCESS] bluethundr at es3.jokefire.com
Stderr: sudo: sorry, you must have a tty to run sudo
[2] 20:31:32 [SUCCESS] bluethundr at es2.jokefire.com
[3] 20:31:32 [SUCCESS] bluethundr at es1.jokefire.com

I'm still getting the 'sorry you must have a tty to run sudo' message
coming from one of the nodes. But the command succeeds so it's no big deal!
Odd tho that one node would be barking about that, considering my
sudoers is distributed via puppet.

Anyway, it's all good as far as I'm concerned. At least this works! I'll
check that 3rd node and see if there's any difference to the sudoers file I
guess.

Thanks for your help!
Tim

On Sun, Nov 1, 2015 at 7:06 PM, Gordon Messmer <gordon.messmer at gmail.com>
wrote:

> On 10/31/2015 04:16 PM, Tim Dunphy wrote:
>
>> Got the same exact message!
>>
>> Anything else I can try?
>>
>
> I think you need to double-check your sudoers file.  Use the '-i' argument
> to pssh to get more information.
>
> # cat /etc/sudoers.d/gordon
> gordon    ALL=(ALL)    NOPASSWD: ALL
>
> $ pssh -h t -i sudo echo true
> [1] 16:02:12 [FAILURE] MYHOST Exited with error code 1
> Stderr: sudo: sorry, you must have a tty to run sudo
>
>
>
> # cat /etc/sudoers.d/gordon
> Defaults:gordon        !requiretty, visiblepw
> gordon    ALL=(ALL)    NOPASSWD: ALL
>
> $ pssh -h t -i sudo echo true
> [1] 16:02:30 [SUCCESS] MYHOST
> true
>
>
>
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> https://lists.centos.org/mailman/listinfo/centos
>



-- 
GPG me!!

gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B