A little more digging suggests that it's not even attempting the SSH 
connection (or is trying the wrong IP/Port?) We're not seeing anything hit 
the virtual router in cloudstack while packer waits for SSH and when I 
edited the config so that it uses a key pair that doesn't match the key 
file being used it still times out. I would expect a near immediate 
authentication error in this case.

debug isn't much use as it just pauses for input rather than showing any 
further detail but with PACKER_LOG=1 I see

[DEBUG] Error getting SSH config: SSH_AUTH_SOCK is not set

which would suggest ssh is not working correctly. But I can SSH from this 
box just fine...


On Wednesday, September 13, 2017 at 4:45:55 PM UTC+1, David Curran wrote:
>
> Just upgraded now
> packer -v
> 1.1.0
>
> Made a change to use "ssh_agent_auth" and added the below to my ssh config:
>
> Host first.three.octets.*
> IdentityFile ~/.ssh/cloudstack.pem
>
> {
>   "builders": [{
>     "type": "cloudstack",
>     "api_url": "{{user `api_url`}}",
>     "api_key": "{{user `api_key`}}",
>     "network": "{{user `network`}}",
>     "secret_key": "{{user `secret_key`}}",
>     "service_offering": "{{user `service_offering`}}",
>     "source_template": "{{user `source_template`}}",
>     "template_os": "{{user `template_os`}}",
>     "zone": "{{user `zone`}}",
>     "instance_name": "{{ user `instance_name`}}-{{timestamp}}",
>     "template_name": "{{user `template_name`}}-{{timestamp}}",
>     "template_password_enabled": true,
>     "template_scalable": true,
>     "expunge": true,
>     "ssh_agent_auth": true,
>     "ssh_username": "{{user `ssh_username`}}",
>     "keypair": "{{user `keypair`}}"
>   }]
> }
>
> Now I get timeouts. Assuming the key, keypair and username are all 
> correct, is this a correct set up for configuring a connection using ssh 
> key?
>
>
> On Wednesday, September 13, 2017 at 4:36:24 PM UTC+1, Rickard von Essen 
> wrote:
>>
>> Are you running the latest version (released today). I have been working 
>> on some cloudstack improvements that was released now some of them involved 
>> improved ssh support. 
>>
>> / Rickard 
>>
>> On Sep 13, 2017 16:38, "David Curran" <[email protected]> wrote:
>>
>> I'm trying to automate the build process for templates and have run into 
>> an issue when trying to use a keypair.
>>
>> I've created a valid keypair in the API:
>>
>> (local) > list sshkeypairs
>> count = 1
>> sshkeypair:
>> name = keyname
>>
>> I copied the output of the command used to create the key to a file as 
>> detailed in 
>> https://shankerbalan.net/blog/ssh-keys-on-cloudstack-guest-instances-using-cloud-init/
>>
>> This is my .json file:
>>
>> {
>>   "builders": [{
>>     "type": "cloudstack",
>>     "api_url": "{{user `api_url`}}",
>>     "api_key": "{{user `api_key`}}",
>>     "network": "{{user `network`}}",
>>     "secret_key": "{{user `secret_key`}}",
>>     "service_offering": "{{user `service_offering`}}",
>>     "source_template": "{{user `source_template`}}",
>>     "template_os": "{{user `template_os`}}",
>>     "zone": "{{user `zone`}}",
>>     "instance_name": "{{ user `instance_name`}}-{{timestamp}}",
>>     "template_name": "{{user `template_name`}}-{{timestamp}}",
>>     "template_password_enabled": true,
>>     "template_scalable": true,
>>     "expunge": true,
>>     "ssh_username": "{{user `ssh_username`}}",
>>     "ssh_private_key_file": "/root/to/cloudstack.pem",
>>     "keypair": "{{user `keypair`}}"
>>   }],
>> }
>>
>> The variables are set in another file.
>>
>> With this configuration I am getting:
>>
>> ==> cloudstack: Waiting for SSH to become available...
>> Build 'cloudstack' errored: unexpected EOF
>>
>> ==> Some builds didn't complete successfully and had errors:
>> --> cloudstack: unexpected EOF
>>
>> I've also tried without the ssh_private_key_file setting but it hangs on 
>> waiting for SSH to become available and eventually times out.
>> I am able to log in with the key file when I run packer and it is waiting 
>> for ssh to become available and checked that the public key matches that 
>> from http://vr/latest/public-keys
>>
>> Assuming I'm doing something stupid, is anyone able to point me in the 
>> right direction?
>>
>> many thanks.
>>
>> -- 
>> This mailing list is governed under the HashiCorp Community Guidelines - 
>> https://www.hashicorp.com/community-guidelines.html. Behavior in 
>> violation of those guidelines may result in your removal from this mailing 
>> list.
>>  
>> GitHub Issues: https://github.com/mitchellh/packer/issues
>> IRC: #packer-tool on Freenode
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Packer" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/packer-tool/16a89b29-0d4d-4df2-bf71-ac3aa9e5514a%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/packer-tool/16a89b29-0d4d-4df2-bf71-ac3aa9e5514a%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/03830284-f606-47d2-b07e-692b9dde8969%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to