This cookbook features:
- A Chef LWRP to configure:
- git
config.name
andconfig.email
- a git-specific private ssh key
- known ssh hosts
- git
- A companion recipe for user::data_bag which adds the aforementioned configuration.
Include recipe[git_user]
in your run_list
and git_user
resource will become available.
The git_user::data_bag
recipe assumes that you're using the user::data_bag
recipe from the excellent user cookbook. It lets you configure git-related aspects in user specific data_bags, e.g.
{
"id" : "testman",
"home" : "/home/testman"
...
"git_user" : {
"enabled" : true,
"full_name" : "Test Man Jr.",
"email" : "[email protected]",
"private_key": "ABC123",
"known_hosts": ["github.com"]
}
}
This cookbook has been tested with the following OSes:
- centos / redhat
- ubuntu
- gentoo
The cookbook has got the following dependencies:
No-op, does nothing.
Processes node['users']
and performs the configuration for the ones whose data_bags enable it, e.g.
{
"id" : "ranger",
...
"git_user" : { "enabled": true, "email": "[email protected]" }
}
Action | Description | Default |
---|---|---|
create | Creates .gitconfig and/or configures the ssh key and known hosts.
|
Yes |
Attribute | Description | Default Value | Required |
---|---|---|---|
login | Name attribute: The login of the user. | nil |
yes |
home | User's home directory. | /home/username or /root |
no |
full_name | A value for git config.name |
username |
no |
A value for git config.email |
"username@#{node['fqdn']}" |
no | |
private_key | A private SSH key to use for git, will be created as /home/username/.ssh/git_user_rsa |
nil |
no |
known_hosts | Hosts which the private_key will be used with |
[] |
yes if private_key is specified |
git_user 'charlie' do
private_key get_my_super_secret_key
known_hosts %w{ github.com bitbucket.org }
end
git_user 'bob' do
full_name 'Bob McAllister'
email '[email protected]'
end
Copyright:: Vasily Mikhaylichenko and LxMx.
Licensed under BSD license.
http://opensource.org/licenses/BSD-2-Clause