gusteau

A tasteful Chef Solo wrapper and configuration manager

  • 所有者: locomote/gusteau
  • 平台:
  • 許可證: BSD 2-Clause "Simplified" License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

Gusteau

"Anyone can cook."

Build Status
Coverage Status
Gem Version

Gusteau is an easy to use configuration manager for Chef Solo and Vagrant. It aims to:

  • Provide existing Chef Solo users with a more efficient workflow
  • Make Chef Solo usable for a small to mid scale multi-node setup
  • Make Chef Solo more accessible for the new users

Some of the features include:

  • YAML for readable, flexible infrastructure configuration
  • Usage of a single SSH connection to stream compressed files and commands
  • Support for normal Chef CLI flags:
    • -W or --why-run (dry run mode)
    • -l for setting a log level and -F for setting an output formatter
  • Bootstrapping target systems with Chef-Omnibus or custom scripts.

Getting started

Gusteau is a Ruby gem:

gem install gusteau

The following command generates an example Chef-repo:

gusteau init project-name

Make sure you read through project-name/README.md first.

A typical .gusteau.yml looks like this:

before:
  - bundle exec berks install --path ./cookbooks

environments:
  development:
    attributes:
      mysql:
        server_root_password: ASahiweqwqe2
      rvm:
        default_ruby: 1.9.3-p362
      users:
       - linguini

    run_list:
      - role[base]
      - recipe[mysql::server]
      - recipe[iptables]

    nodes:
      playground:
        host: 33.33.33.20
        password: omgsecret

Converging a server

The following command will run the whole run_list on the node.

gusteau converge development-playground

Use the --bootstrap or -b flag to bootstrap chef-solo (e.g. during the first run).

Applying individual recipes

You may choose to run a custom run_list instead of the full convergence.

gusteau apply development-playground "role[base],recipe[oh-my-zsh]"

SSH

Gusteau provides a useful shortcut that you may use to ssh into a node. If you haven't got passwordless authentication set up, Gusteau will use user and password values from the node configuration.

gusteau ssh development-playground

Please note that expect utility must be installed for gusteau ssh to work.

If you prefer calling ssh directly, you will find the gusteau ssh_config subcommand useful:

gusteau ssh_config >> ~/.ssh/config

Vagrant Plugin

Gusteau can save you from writing some Vagrantfile boilerplate code. It enables you to move node specific Vagrant configuration away from the Vagrantfile into node definitions. The Vagrant plugin for Gusteau means you can then bring up this node in VirtualBox.

development:
  nodes:
    www:
      vagrant:
        IP: 192.168.100.20
        cpus: 1
        memory: 512
        box_url: 'https://opscode-vm.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box'

The following snippet in the Vagrantfile configures Vagrant for all nodes (as above) listed in Gusteau which have vagrant sections defined.

Vagrant.configure('2') do, config, Gusteau::Vagrant.detect(config) do, setup, setup.prefix = 'loco'
    setup.defaults.box_url = 'http://example.com/vm/opscode_centos-6.4.box'
  end
end
  • The prefix option lets you prepend your VirtualBox VMs names, e.g. loco-nodename.
  • The defaults one lets you provide default values for cpus, memory, box_url, box.

Please note that the add-on only works with Vagrant ~> 1.2 and needs Gusteau to be installed as a Vagrant plugin:

vagrant plugin install gusteau

Once the Gusteau plugin for Vagrant is installed you can start up VirtualBox using the environment and node data for vagrant in .gusteau.yml:

vagrant up development-www

Configuration

Before and after hooks

You can tell Gusteau to execute specific commands before and / or after converge or apply take place. They get executed on the host system. Example .gusteau.yml snippet:

before:
  - bundle exec librarian-chef install

after:
  - bundle exec rake spec

Attributes

In addition to specifying attributes for environments you can set node-specifc ones. They will be deep-merged with environment ones:

environments:
  staging:
    attributes:
      hostname: staging
    nodes:
      one:
        attributes: { hostname: staging-one }
      two:
        attributes: { hostname: staging-two }

Run lists

You can also override run_list for specific nodes.

Bootstrap script

By default, Gusteau installs the Omnibus Chef 11.4.4. You can also set the Omnibus Chef version explicitly by specifying it in .gusteau.yml:

chef_version: 10.26.0

If you're targeting a non Omnibus-supported platform you might want to specify the platform value for a node: this invokes a specific script.

Alternatively, you can specify a custom script in .gusteau.yml:

bootstrap: ./scripts/freebsd.sh

Custom cookbooks path

By default, Gusteau uploads and sets Chef Solo up to use cookbooks from ./cookbooks and ./site-cookbooks directories. If it doesn't work for you, you can override these values in .gusteau.yml:

cookbooks_path: [ './my-cookbooks', '../something-else' ]
roles_path: './base-roles'

Custom Chef run configuration directory (e.g. /etc/chef)

By default, Gusteau uploads the necessary files and folders (i.e. cookbooks and roles directories) to /etc/chef/.

You can specify a custom target directory in .gusteau.yml:

chef_config_dir: /etc/custom_chef_dir

主要指標

概覽
名稱與所有者locomote/gusteau
主編程語言Ruby
編程語言Ruby (語言數: 3)
平台
許可證BSD 2-Clause "Simplified" License
所有者活动
創建於2012-12-27 03:06:56
推送於2017-09-04 02:09:59
最后一次提交2016-11-09 11:14:26
發布數20
最新版本名稱v1.3.0 (發布於 2013-12-05 12:43:26)
第一版名稱0.3.8 (發布於 )
用户参与
星數65
關注者數76
派生數18
提交數163
已啟用問題?
問題數25
打開的問題數4
拉請求數22
打開的拉請求數4
關閉的拉請求數3
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?