ChefHelpers
This gem provides a set of helper methods to use in chef recipies. Currently, the only implemented method is #encrypt_password
, which takes a plain-text password and generates a shadow hash for use by the User resource.
Installation
Add this line to your application's Gemfile:
gem 'chef_helpers'
And then execute:
$ bundle
Or install it yourself as:
$ gem install chef_helpers
Usage
Include the gem in your chef cookbook:
In a recipe:
extend ChefHelpers
In an LWRP:
include ChefHelpers
In any ruby file:
include ChefHelpers
Encrypt a password like this:
password = 'shhitsasecret'
shadow_hash = encrypt_password(password)
Use it in a user recipe like this:
password_hash = encrypt_password('shhitsasecret')
user 'my_user' do
password password_hash
...
end
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Contributing
- Fork this repo
- Create a new branch for your feature
- Write specs for the feature / method
- Implement the feature / method
- Create a pull request
- ???
- Profit
Bug reports and pull requests are welcome on GitHub at https://github.com/baberthal/chef_helpers.
License
The gem is available as open source under the terms of the MIT License.