Bootstrapping an Existing EC2 server


#1

Hi All,

I got my Chef Server and Chef workstation configured on an AWS VM running Centos. I downloaded the chef-repo from GitHub as per the instructions.

I downloaded the keys from my Chef Server. I also had keys from Amazon to use their EC2 API (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY). I also created a key at Amazon for use with the instance (test.pem). All the keys are in ~chef-repo/.chef/ and in ~/.ssh/.

I am trying to bootstrap an existing ec2 instance in a specific environment and under a specific role.

I have used the following command:

knife bootstrap Server_IP --ssh-user root --sudo --identity-file ~/.ssh/test.pem --environment testing --node-name Centos_Node --run-list ‘role[web_server]’

This command adds the node to the default environment.

Please help me to resolve the issue.

Thanks & Regards,
Jyoti Bhanot


#2

Hello Jyoti,
If you were able to bootstrap the node at all, then all is well with the
keys you have in your .chef and .ssh directories, and your AWS API keys
likely have nothing to do with your issue, either.
It looks like you’re doing three things with your bootstrap command:

  1. Name the node “Centos_Node”
  2. Add the “web_server” role to its run list
  3. Set the environment to “testing”

So here’s what I’m wondering:

  • Do step #1 and #2 above take effect normally, i.e. once bootstrapping is
    complete, is the node indeed called “Centos_Node” and does its run list
    contain the web_server role and its dependents (if any)?
  • Did you double-check that you did, in fact, create an environment called
    "testing" and upload it to the Chef Server? You may have created it but
    never uploaded it. If the environment you specify in the bootstrap command
    does not exist on the Chef Server, then it won’t get assigned to the node.
    You can check if the environment exists simply by typing:
    knife environment list If it's not there, create testing.rb in ~/chef-repo/environments. You could start with a single line in it: name 'testing' You can refer to http://docs.opscode.com/essentials_environments.html to create environments. Once the environment exists on your workstation, type: knife environment from file testing.rb
    Then check again if the environment now exists on the server, and then you
    should be able to assign it to your node.

-Fabien

On Thu, Jun 19, 2014 at 3:58 AM, Bhanot, Jyoti Jyoti.Bhanot@netapp.com
wrote:

Hi All,

I got my Chef Server and Chef workstation configured on an AWS VM running
Centos. I downloaded the chef-repo from GitHub as per the instructions.

I downloaded the keys from my Chef Server. I also had keys from Amazon to
use their EC2 API (AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY). I also
created a key at Amazon for use with the instance (test.pem). All the keys
are in ~chef-repo/.chef/ and in ~/.ssh/.

I am trying to bootstrap an existing ec2 instance in a specific
environment and under a specific role.

I have used the following command:

knife bootstrap Server_IP --ssh-user root --sudo --identity-file
~/.ssh/test.pem --environment testing --node-name Centos_Node --run-list
’role[web_server]’

This command adds the node to the default environment.

Please help me to resolve the issue.

Thanks & Regards,

*Jyoti Bhanot *