Giter Site home page Giter Site logo

chef-repo-template's Introduction

Overview

Chef repo template ready to use with knife-zero.

Read tutorial - Provisioning remote server accessible by SSH with Chef and knife-zero.

Directory structure:

  • berks-cookbooks — Chef cookbooks managed by Berkshelf
  • site-cookbooks - custom cookbooks
  • data_bags — Chef Data Bags
  • nodes — Chef nodes (folder with roles for each machine)
  • roles — Chef roles (role is a group of recipes and additional attributes)
  • environments— Chef environments

Quick start

  • edit Berfkshelf include external cookbooks

  • install external cookbooks using Berkshelf

berks install
  • add roles for your servers

example roles/myrole.json:

{
  "name": "myrole",
  "description": "my sample role",
  "json_class": "Chef::Role",

  "default_attributes": {
    "var1": "some-value-1"
  },

  "run_list": [
    "recipe[chef-cookbook-example-1]",
    "recipe[temp1]"
  ]
}

specify the list of recipes to run and default attributes.

  • bootstrap the server (one time)
knife zero bootstrap 11.22.33.44 --ssh-user ubuntu --ssh-password mypass --node-name mynode1

it will create file nodes/mynode1.json with server attributes.

  • server attributes

if you have additional attributes for this server - use attributes file (see example servers/myserver.json).

  • run provision with attributes
knife zero converge  "name:mynode1"  --ssh-user root --ssh-password root --json-attributes servers/myserver.json --override-runlist "role[myrole]"

it will run all recipes specified in role file 'roles/myrole.json'. Attributes in file servers/myserver.json will override default attributes specified in role.

see more options for knife zero converge here.

Cookbooks

  • add custom cookbook
cd site-cookbooks
chef generate cookbook example1

it will create a new folder site-cookbooks/example1 with cookbook.

Roles

  • add roles to roles/ folder

Attributes

  • attributes for servers

  • place in folder /servers

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.