Manually Run a Chef Script on OpsWorks
Let’s say you’re manually testing a recipe on one of your OpsWorks instances. This recipe is the nth step in a multi-step process and you’ve fully tested and integrated into your “Setup” lifecycle event all the recipes that handle steps 1 through n-1.
The highlighted recipe is such a recipe. It resides within a parent recipe that resides in the root folder of the Git repository for the application.
Open the instance you want to test this recipe on and look in the upper right hand corner. You will see a command button group.
Click the “Run Command” button. This will allow you to perform a lot of useful tasks.
- Update Custom Cookbooks: basically does a Git clone to pull down all the recipes that are housed in your Git repository.
- Execute Recipes: manually invokes a recipe of your specification locally on the instance. It’s important to note that if you have made changes to git and you haven’t invoked “Update Custom Cookbooks” the cookbooks on the instance might be out of date.
- Setup: invokes the recipes associated with the “Setup” lifecycle event
- Configure: invokes the recipes associated with the “Configure” lifecycle event
Notice how you take the “.rb” off the recipe when you invoke it using the OpsWorks dashboard. It’s important to recognize that this is not a physical file system path but a logical path to the recipe that Chef knows how to parse.