Git Product home page Git Product logo

chef-whitelist's Introduction

Description

This library enables easy rollout of changes on a per host basis. The whitelist is stored in a data bag and can contain single hostnames or roles. Hostnames are checked first and can contain glob patterns to enable similarly named hostgroups. If none of the hostnames match, all roles in the roles array are checked whether the host has one of them applied.

Requirements

Attributes

Usage

First create a data bag item under the whitelist data bag and give it a descriptive name. You don't have to use the whitelist data bag but the library defaults to that name. Then add hosts and roles you want to enable for the rollout:

{
  "id": "my_whitelist",
  "patterns": [
    "host.example.com",
    "*.subdomain.example.com",
    "prefix*.example.com"
  ]
}

And the same example with the addition of roles:


{
  "id": "my_whitelist",
  "patterns": [
    "host.example.com",
    "*.subdomain.example.com",
    "prefix*.example.com"
  ],
  "roles": [
    "Webserver",
    "DatabaseServer"
  ]
}

In your cookbooks you then have to add a dependency on the library cookbook in metadata.rb like so:

depends "chef-whitelist"

Now all the recipes can branch depending on inclusion in a specific whitelist with this simple statement:

if node.is_in_whitelist? "my_whitelist"
  # new hawtness
else
  # old stuff
end

If you don't use the default whitelist data bag and patterns key for hostnames, you have to adapt the call to include the actual names:

node.is_in_whitelist? "my_whitelist", "whitelist_databag", "hostnames"

Contributing

  • Fork the project
  • Add your feature
  • If you are adding new functionality, document it in the README
  • Push the branch up to GitHub (bonus points for topic branches)
  • Send a pull request to the etsy/chef-whitelist project.

If you have questions, you can find us on IRC in the #codeascraft channel on Freenode.

chef-whitelist's People

Contributors

mrtazz avatar thereforsunrise 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.