I would start by creating a template where you have some fixed credentials that you can use for debugging (or use the console). Run packer build --on-error=ask, so when it fails you have time to troubleshoot.
Jump into the node to debug if cloud-init is functioning as it should, see http://cloudinit.readthedocs.io/en/latest/topics/datasources/cloudstack.html You should be able to curl down the public key for the key-pair somewhere on http://10.1.1.1/latest/user-data. Then check the cloud-init logs to see if there is any error configuring you image. If you get stuck post some more details here. On 19 September 2017 at 13:26, David Curran <[email protected]> wrote: > I'm trying to build CentOS templates in cloudstack using Packer. > > Below is a config.json that works for ubuntu using temporary keys: > > > "builders": [{ > "type": "cloudstack", > "communicator": "ssh", > "ssh_username": "{{user `ssh_username`}}", > "ssh_handshake_attempts": 2, > "ssh_password": "", > > "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`}}", > "expunge": true, > "public_ip_address": "{{user `public_ip`}}", > > "template_name": "{{user `template_name`}}-{{isotime \"020106-0304\"}}", > "template_password_enabled": true, > "template_scalable": true > > }], > > > The part that is failing is SSH on to the newly built VM. > > > "handshake error: ssh: handshake failed: ssh: unable to authenticate, > attempted methods [none publickey], no supported methods remain" > > I am able to log in to the machine with the password generated by cloud > stack (passwordenabled = true) but not with the generated key. When I log > in with password I can't see any .ssh/ directory and therefore the > temporary public key isn't in the correct authorized_keys file. > > That explains why SSH fails, it is trying public key auth but can't do it. > > However, when using winrm communicator with windows VMs, if winrm_password > is left blank or is left out entirely then it defaults to the generated > password. Is this not possible with the SSH communicator? > > Or is there a reason that the public key isn't being put on to the VM in > the first place? > > -- > 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/ad3279b3-dd6c-4392-aaa3-883e0c223910%40googlegroups.com > <https://groups.google.com/d/msgid/packer-tool/ad3279b3-dd6c-4392-aaa3-883e0c223910%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/CALz9Rt-b9ec3ZDrs7pjM1RZHQ10p7Wty%2BRYCXvcj_1x-t%2BPBuw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
