Using Chef Client Provisioner fails

295 views
Skip to first unread message

Pietto Vasco

unread,
Mar 6, 2019, 10:29:34 AM3/6/19
to Packer
im trying to add the chef-client to my packer builds. To do this im using 
{
  "type": "chef-client",
  "server_url": "https://mychefserver.com/"
}

Is my results

 amazon-ebs: [2019-03-06T15:06:12+00:00] WARN: Failed to read the private key /etc/chef/validation.pem: #<Errno::ENOENT: No such file or directory @ rb_sysopen - /etc/chef/validation.pem>
    amazon-ebs:
    amazon-ebs: ================================================================================
    amazon-ebs: Chef encountered an error attempting to create the client "packer-5c7fe1db-8e69-16d3-e6a6-a3f654ca501a"
    amazon-ebs: ================================================================================
    amazon-ebs:
    amazon-ebs: Private Key Not Found:
    amazon-ebs: ----------------------
    amazon-ebs: Your private key could not be loaded. If the key file exists, ensure that it is
    amazon-ebs: readable by chef-client.
    amazon-ebs:
    amazon-ebs: Relevant Config Settings:
    amazon-ebs: -------------------------
    amazon-ebs: validation_key "/etc/chef/validation.pem"
    amazon-ebs:
    amazon-ebs: System Info:
    amazon-ebs: ------------
    amazon-ebs: chef_version=14.10.9
    amazon-ebs: ruby=ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]
    amazon-ebs: program_name=/usr/bin/chef-client
    amazon-ebs: executable=/opt/chef/bin/chef-client
    amazon-ebs:
    amazon-ebs:
    amazon-ebs: Running handlers:
    amazon-ebs: [2019-03-06T15:06:12+00:00] ERROR: Running exception handlers
    amazon-ebs: Running handlers complete
    amazon-ebs: [2019-03-06T15:06:12+00:00] ERROR: Exception handlers complete
    amazon-ebs: Chef Client failed. 0 resources updated in 01 seconds
    amazon-ebs: [2019-03-06T15:06:12+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
    amazon-ebs: [2019-03-06T15:06:12+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
    amazon-ebs: [2019-03-06T15:06:12+00:00] FATAL: Chef::Exceptions::PrivateKeyMissing: I cannot read /etc/chef/validation.pem, which you told me to use to sign requests!
    amazon-ebs: Creating configuration file 'knife.rb'
==> amazon-ebs: Cleaning up chef node...
    amazon-ebs: WARN: Failed to read the private key /tmp/packer-chef-client/mykey.pem: #<Errno::ENOENT: No such file or directory @ rb_sysopen - /tmp/packer-chef-client/mykey.pem>
    amazon-ebs: ERROR: Your private key could not be loaded from /tmp/packer-chef-client/mykey.pem
    amazon-ebs: Check your configuration file and ensure that your private key is readable
==> amazon-ebs: Terminating the source AWS instance...
==> amazon-ebs: Cleaning up any extra volumes...
==> amazon-ebs: No volumes to clean up, skipping
==> amazon-ebs: Deleting temporary security group...
==> amazon-ebs: Deleting temporary keypair...
Build 'amazon-ebs' errored: Error cleaning up chef node: Failed to cleanup node: Non-zero exit status. See output above for more info.

Command: sudo knife node delete packer-5c7fe1db-8e69-16d3-e6a6-a3f654ca501a -y -c /tmp/packer-chef-client/knife.rb

==> Some builds didn't complete successfully and had errors:
--> amazon-ebs: Error cleaning up chef node: Failed to cleanup node: Non-zero exit status. See output above for more info.

Command: sudo knife node delete packer-5c7fe1db-8e69-16d3-e6a6-a3f654ca501a -y -c /tmp/packer-chef-client/knife.rb


Here is my json:

{


    "builders": [
        {
            "type": "amazon-ebs",
           "access_key": "access",
           "secret_key": "secret",
           "region": "us-east-1",
            "source_ami": "ami-0080e4c5bc078760e",
            "instance_type": "t2.micro",
            "ssh_username": "ec2-user",
            "ami_name": "packerchef"
          }
  ],

"provisioners": [
    {
       "type": "chef-client",
       "server_url": "https://api.chef.io/organizations/myorg",
       "client_key": ",mykey.pem"

           }
     ]
}




Gangadhar

unread,
Mar 7, 2019, 5:56:30 AM3/7/19
to packe...@googlegroups.com
client_key": ",mykey.pem" in this is it , needed before mykey word?

--
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 packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/3ef1cf1b-0fed-43e3-8496-b2a67fd50e09%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages