Coder Social home page Coder Social logo

chef-cookbook-templates's Introduction

Standarized cookbook templating and naming conventions for chef

Based on Alessandro Franceschi / Lab42 idea for Puppet modules templating and Jorge Espada's tmux cookbook.

This repository contains various experiments on Chef cookbooks design.

Alternative solutions are researched and published to provide basic sample cookbooks that can be used as blueprint for the (quick) generation of new basic cookbooks of different nature, upon which the relevant customizations can be done.

A set of common attributes (and possibly community standard) greatly enhances cookbooks usability and interoperability. These cookbooks templates implement an early proposal for a Standard Cookbook Interface: a set of common and standard attributes that provide standard and predictable functionalities.

I personally think that something like this would be of great benefit for the Chef Modules ecosystem.

All these cookbooks feature some common principles:

  • True reusability: you can completely manage the behaviour of the cookbook via the attributes it exposes.

  • Easy Multi OS support implementation: all internal references to paths are abtracted when possible.

  • Configuration freedom: you can provide configuration files, attributes and whole dirs in the way you want.

  • Behaviour management: you can define how the cookbook's resources behave.

  • Decommissioning support: All the resources can be installed and removed.

COMMON TOOLS CONFIGURED IN THE GENERATED SCAFFOLD

All these templates create scaffolds ready to start development, with the following tools configured:

  • Berkshelf: For cookbook dependencies management and development.
  • Rubocop: for linting.
  • Foodcritic: to write cookbooks following best/recommended practices.
  • Chefspec: default specs are provided, with descriptive tests for the expected basic behaviour. You can run:
rake spec

in the directory of the created template, to check them.

  • Serverspec: to test your cookbook on the server side.
  • Kitchen-CI: configured to use chef_zero on the following default vms:
    • opscode-debian-7.4
    • opscode-ubuntu-14.04
    • opscode-centos-6.5
    • opscode-centos-5.10
  • Vagrant: to do testings on the mentioned Virtualbox VMs.

TEMPLATES TYPES

Following the proposed cookbook types from (FIXME!), there are a few templates to choose from:

pack_conf

Tthis template creates a cookbook to manage a package and its configuration files and directories. Useful for packages that don't have a daemon or service (ie vim, mc, etc.)

pack_conf_serv

This template creates a cookbook to manage an application, its configuration files and directories and the service/daemon it provides. Typical examples are apache, ftpd, etc.

USAGE

  1. Clone this repo

  2. Chosee the template more suitable for the cookbook you want to create. (Check under the templates directory).

  3. Run

./cookbook_clone.sh -t pack_conf -n vim
  1. Change to the newly created directory:
cd vim-cookbook
  1. Modify as you please :)

Obviously, there's a lot of room for improvement. These templates don't attempt to cover all the cookbooks you might need to write and just expect to make it easier to start writing a cookbook.

Feel free to send me any comments, patches, suggestions or ideas. They will be very welcome.

chef-cookbook-templates's People

Contributors

javierbertoli avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.