Sunday, June 11, 2017

How do I bootstrap a node that was created from an AMI snapshot?

In order to bootstrap a node that was created from an AMI snapshot, perform the following cleanup tasks

Log in to the node and uninstall chef

sudo yum remove chef

Remove leftover chef directories

sudo rm -r /etc/chef
sudo rm -r /opt/chef
sudo rm -r /var/chef

Create the new node with Knife and attempt to bootstrap the node with your new parameters

knife bootstrap <IP> -N <Node-Name> -x ec2-user -i ~/.ssh/<SSHKEYNAME>.pem --sudo


What are a good list of useful Chef sites?

-------------------------------------------------------------------------------

Packages


Cookbooks

What is the current workflow for modifying/running a Chef cookbook?

The usage of $ characters in the examples are used to denote where strings need to be updated when typing the command.

  • Clone chef-repo from bitbucket.org
  • Clone devops from bitbucket.org (optional if you wish you to use Chef wrapper scripts)
  • Modify common cookbook file:Update recipes/default.rb,Update attributes/default.rb Update metadata.rb version number
  • Commit and push cookbook changes to bitbucket.org
  • Upload cookbook to Chef-server,Example: knife cookbook upload cookbook
  • Update run_list on node,Example: knife node run_list add "Chef node name" recipe['$cookbook_name::$recipe_name'].
  • Execute run_list against targeted role,Example: knife ssh -i "$identity_file" -x "$username" "role:$role" 'sudo chef-client'
  • Remove run_list recipe on node,Example: knife node run_list remove "Chef-node-name" recipe['$cookbook_name::$recipe_name'] 
  • No comments:

    Post a Comment