Giter VIP home page Giter VIP logo

policyfiles_training's Introduction

Chef Policyfiles Training Lab

Policyfile

About

A training lab on how to use Chef Policyfiles

Policies are built by defining a Policyfile, which looks similar to a Chef Role combined with a Berksfile.

When a Policy is ready for upload, a workstation command included with the ChefDK compiles the Policyfile into a Policyfile.lock.json file. This locked Policy, along with all of the cookbooks it references, are treated as a single unit by the Chef tooling. The bundle of Policyfile.lock.json and cookbooks are uploaded to the server simultaneously.

Policyfiles have a number of clear benefits:

  • They ensure the cookbooks running in production are the same versions that were tested against; providing safer development workflows
  • They solve the Roles and Environments versioning issues
  • They streamline the Roles and Environments patterns and dependency management into a single workflow
  • This reduction of discreet concepts reduces the learning curve for getting started with Chef

Why use Policyfiles ?

Policyfiles provide cookbook dependency management and replaces Roles and Environments. This allows you to get exact, repeatable results!

Policies make your chef-client runs completely repeatable, because cookbooks referenced in a Policy are identified by a unique hash based on their contents. This means that once the lock file + cookbook bundle has been generated, the code underlying it will never change.

Policyfiles ensure all dependent cookbooks are pinned, all attributes are saved and it is all versioned, testable, and ready for your pipeline.

If you are familuar with Chef Server Roles, run lists and Environments, then:

  • policy_name = role/runlist
  • policy_group = environment

How do you use a Policyfile ?

The best way to use policyfiles is within a pipeline. Here is a Jenkins example to give you some ideas, but you can see much more detail in this repo - https://github.com/anthonygrees/chef_pipelines

Cookbook Pipeline

Training Lab

This training lab is a hands on set of code examples to show you how policyfiles work. It covers how to create and modify, plus using policy_groups and exporting them as tarballs.

Let's write some code.

Other Policyfiles Resources

Alt text


License and Author

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

policyfiles_training's People

Contributors

anthonygrees avatar mattray 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.