Provides ability to manage netrc files with Chef.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
attributes
bin
libraries
recipes
test
.gitattributes
.gitignore
.kitchen.yml
.rspec
.rubocop.yml
.travis.yml
.yardopts
Berksfile
Gemfile
Guardfile
LICENSE
README.md
Rakefile
chefignore
metadata.rb

README.md

netrc-cookbook

Release Build Status Code Coverage

Provides ability to manage netrc files for users with Chef.

Attributes

Key Type Description Default
['netrc']['bag_name'] String Bag name to find Chef Vault items. netrc
['netrc']['users'] Array Users to install netrc from Chef Vault. []

Usage

netrc::default

The default recipe will install the netrc gem as well as include the Chef Vault and Chef Sugar cookbooks. If the node['netrc']['users'] attribute has been set it will use the LWRP to create a netrc file for the specified user.

Data Bag

{
    "id": "jbellone",
    "test": {
        "machines": [
            {
                "host": "github.com",
                "login": "johnbellone",
                "password": "bacon"
            }
        ]
    },
    "beta-us-east-1": {
        "machines": []
    }
    "prod-us-east-1": {
        "machines": []
    }
}

LWRP

The resource provider can be used on its own if you are storing your secret credentials in a separate data bag. Here's an example of a simple data bag which stores the username and access token for a GitHub user.

item = chef_vault_item('secrets', 'github')
netrc 'jbellone' do
  host 'github.com'
  login item['username']
  password item['access_token']
end

The bag item for this example would look like:

{
    "id": "github",
    "username": "johnbellone",
    "access_token": "bacon"
}