rundeck-plugins / rundeck-ec2-nodes-plugin

Get resource node data from Amazon EC2
85 stars 45 forks source link

Run command with sudo without disabling requiretty #53

Open amitdaniel86-zz opened 8 years ago

amitdaniel86-zz commented 8 years ago

Hi ,

I'm using the rundeck-ec2-nodes-plugin and i need to run command with sudo .

when I'm running them as sudo I'm getting the next error :

sudo: sorry, you must have a tty to run sudo

i don't want to comment : Defaults requiretty from sudoers file . Also i didn't fine if i can add "sudo authentication" for ec2 plugin .

Thanks for your help Amit

amitdaniel86-zz commented 8 years ago

@gschueler

Can you help ?

gschueler commented 8 years ago

enable sudo for the node see http://rundeck.org/docs/plugins-user-guide/ssh-plugins.html#secondary-sudo-password-authentication

for ec2 plugin you willl have to add the attributes to the mapping definition in the plugin

amitdaniel86-zz commented 8 years ago

@gschueler

added :

ssh-keypath.default=/var/lib/rundeck/.ssh/id_rsa;username.default=rundeck;hostname.selector=privateIpAddress;sudo-command-enabled="true"

but still i'm getting tty issue:

sudo: sorry, you must have a tty to run sudo 09:38:02 Remote command failed with exit status 1 09:38:02 Failed: NonZeroResultCode: Remote command failed with exit status 1

gschueler commented 8 years ago

you would need sudo-command-enabled.default=true

dvg06 commented 7 years ago

@gschueler I have this entry, but still getting errors - anything I am missing?

gschueler commented 7 years ago

@dvg06 what does your generated node definition look like?

dvg06 commented 7 years ago

@gschueler apologies , newbie here. I am trying to use ec2 plugin since I wanted to run commands as splunk user in many instances. I do no have the password, but ec2-user has sudo su access.

field mapping: nodename.selector=instanceId;privateIpAddress.selector=privateIpAddress;hostname.selector=privateIpAddress,privateDnsName,publicDnsName;username.default=centos; sudo-command-enabled.default=true

dvg06 commented 7 years ago

@gschueler - anything I am missing ?

yellow-straw-hat commented 7 years ago

@amitdaniel86 When configuring the Node Executor, make sure to check the "Force PTY" checkbox, this will always force the use of a new pty.