InSpec
- This is an opensource framework for testing and auditing your applications and infrastructure. Refer Here for the official docs
- Chef inspec comes with built in resources to test the behavior of your cookbook Refer Here
- Scenario: Lets test our tomcat cookbook
- Lets verify whether java is installed or not Refer Here for package resource
- Write tests Refer Here for the changes made
- Now execute
kitchen verify
Chef Cookstyle
- This is a code linting tool that helps you in writing better chef cookbooks.
- This increases code quality by
- Enforcing style conventions & best practices
- Maintaining uniformityin the source code
- Detecting common mistakes that cause code to behave incorrectly or fail
- To run cookstyle execute
cookstyle <path to cookbook> - To autocorrect execute
cookstyle -a <path to cookbook> - Refer Here for the changeset with cookstyle corrections
- Refer Here for official documentation
Chef Custom Resources
- In chef in some cases we might be intrested in create our own resources to perform some application action, Chef gives option to create our own resources
- Execute
chef generate resource --help
- Refer Here for official docs
- Now lets generate a resource called as qttomcat

- Lets write a custom resource to install java Refer Here for the changeset

- Created one more custom resource to deploy war file Refer Here for the changeset
