rundeck-plugins / rundeck-ec2-nodes-plugin

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

default hostname selector should fallback to privateIpAddress #44

Closed Jinkxed closed 7 years ago

Jinkxed commented 8 years ago

Hey,

So I'm getting all this working and noticed that anything that requires SSH to a remote node, the rundeck server seems to using its own local ip instead. I think maybe it's not mapping the privateipaddress correctly for the remote node?

Example:

Executing command on node: example-node-1234, NodeEntryImpl{tags=[pony, staging, worker, running], attributes={tags=ec2, osFamily=unix, osArch=x86_64, state=running, instanceId=i-b62a5032, editUrl=https://console.aws.amazon.com/ec2/home#s=Instances&selectInstance=${node.instanceId}, hostname=, privateDnsName=ip-10-0-11-25.ec2.internal, sshport=22, privateIpAddress=10.0.11.25, username=test, description=EC2 node instance, nodename=example-node-1234, osName=Linux}, project='null'}
15:29:42    example-node-1234    1. Copying manage_applications.sh to the remote server @ /tmp/manage_applications.sh   [workflow] beginExecuteNodeStep(example-node-1234): NodeDispatch: StepExecutionItem{type='NodeDispatch', keepgoingOnSuccess=false, hasFailureHandler=false}
15:29:42            Begin copy 1173 bytes to node example-node-1234: /var/lib/rundeck/repos/rundeck/manage_applications.sh -> /tmp/manage_applications.sh
15:29:42            Using ssh keyfile: /var/lib/rundeck/.ssh/id_rsa
15:29:42            copying file: '/var/lib/rundeck/repos/rundeck/manage_applications.sh' to: 'example-node-1234:/tmp/manage_applications.sh'
15:29:42            Using private key file: /var/lib/rundeck/.ssh/id_rsa
15:29:42            Set timeout to 0
15:29:42            Connecting to :22  <--- Is this supposed to have an ipaddress?
15:29:42            Connecting to  port 22
15:29:42            Connection established
Jinkxed commented 8 years ago

Nevermind I found the issue. This really should be noted in the documentation somewhere.

If you want to use the privateIPaddress of your ec2 instances, add this to your mapping file or just copy and paste the default and change:

hostname.selector=privateIpAddress
adubkov commented 8 years ago

Thank you! This definitely should be highlighted in documentation.

gschueler commented 8 years ago

I am going to re-open this and rename. I think the default mapping should also include the privateIpAddress as a fallback.

dvg06 commented 7 years ago

I have hostname.selector=privateDnsName in mapping params, but when I search for nodes under command section, I get 2 hostnames - one is null and other other one is the private dns. Since one is coming as null, I am unable to execute the query . Please help.

15:02:01 i-01addfae Failed: ConfigurationFailure: Hostname must be set to connect to remote node 'i-01addfae' 15:02:01 i-0e638cdf Failed: ConfigurationFailure: Hostname must be set to connect to remote node 'i-0e638cdf' 15:02:01 i-2335778c Failed: ConfigurationFailure: Hostname must be set to connect to remote node 'i-2335778c' 15:02:01 i-27ce8e88 Failed: ConfigurationFailure: Hostname must be set to connect to remote node 'i-27ce8e88' 15:02:01 i-2b8dc084 Failed: ConfigurationFailure: Hostname must be set to connect to remote node 'i-2b8dc084' 15:02:01 i-7a3765d5 Failed: ConfigurationFailure: Hostname must be set to connect to remote node 'i-7a3765d5' 15:02:01 i-813c7e2e Failed: ConfigurationFailure: Hostname must be set to connect to remote node 'i-813c7e2e'