from-scratch 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.chef/knife.rb +6 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Berksfile +17 -0
- data/Berksfile.lock +19 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +58 -0
- data/Rakefile +6 -0
- data/Thorfile +5 -0
- data/bin/scratchify +6 -0
- data/chefignore +101 -0
- data/cookbooks/chef_gem/CHANGELOG.md +24 -0
- data/cookbooks/chef_gem/README.md +38 -0
- data/cookbooks/chef_gem/libraries/chef_gem.rb +72 -0
- data/cookbooks/chef_gem/metadata.json +29 -0
- data/cookbooks/chef_gem/recipes/default.rb +0 -0
- data/cookbooks/java/.gitignore +21 -0
- data/cookbooks/java/.kitchen.docker.yml +15 -0
- data/cookbooks/java/.kitchen.yml +126 -0
- data/cookbooks/java/.travis.yml +6 -0
- data/cookbooks/java/Berksfile +10 -0
- data/cookbooks/java/CHANGELOG.md +398 -0
- data/cookbooks/java/CONTRIBUTING.md +12 -0
- data/cookbooks/java/Gemfile +15 -0
- data/cookbooks/java/ISSUES.md +43 -0
- data/cookbooks/java/LICENSE +201 -0
- data/cookbooks/java/README.md +402 -0
- data/cookbooks/java/Rakefile +60 -0
- data/cookbooks/java/TESTING.md +41 -0
- data/cookbooks/java/attributes/default.rb +146 -0
- data/cookbooks/java/libraries/helpers.rb +120 -0
- data/cookbooks/java/libraries/matchers.rb +5 -0
- data/cookbooks/java/metadata.json +69 -0
- data/cookbooks/java/providers/alternatives.rb +94 -0
- data/cookbooks/java/providers/ark.rb +255 -0
- data/cookbooks/java/recipes/default.rb +22 -0
- data/cookbooks/java/recipes/default_java_symlink.rb +19 -0
- data/cookbooks/java/recipes/homebrew.rb +3 -0
- data/cookbooks/java/recipes/ibm.rb +76 -0
- data/cookbooks/java/recipes/ibm_tar.rb +70 -0
- data/cookbooks/java/recipes/openjdk.rb +74 -0
- data/cookbooks/java/recipes/oracle.rb +74 -0
- data/cookbooks/java/recipes/oracle_i386.rb +73 -0
- data/cookbooks/java/recipes/oracle_jce.rb +75 -0
- data/cookbooks/java/recipes/oracle_rpm.rb +60 -0
- data/cookbooks/java/recipes/purge_packages.rb +20 -0
- data/cookbooks/java/recipes/set_attributes_from_version.rb +55 -0
- data/cookbooks/java/recipes/set_java_home.rb +44 -0
- data/cookbooks/java/recipes/windows.rb +82 -0
- data/cookbooks/java/resources/alternatives.rb +30 -0
- data/cookbooks/java/resources/ark.rb +58 -0
- data/cookbooks/java/templates/default/ibm_jdk.installer.properties.erb +3 -0
- data/cookbooks/java/templates/default/oracle.jinfo.erb +6 -0
- data/cookbooks/rvm/.foodcritic +1 -0
- data/cookbooks/rvm/.gitignore +7 -0
- data/cookbooks/rvm/.kitchen.yml +66 -0
- data/cookbooks/rvm/.travis.yml +9 -0
- data/cookbooks/rvm/Berksfile +10 -0
- data/cookbooks/rvm/CHANGELOG.md +253 -0
- data/cookbooks/rvm/CODE_OF_CONDUCT.md +12 -0
- data/cookbooks/rvm/CONTRIBUTING.md +26 -0
- data/cookbooks/rvm/Gemfile +20 -0
- data/cookbooks/rvm/Guardfile +12 -0
- data/cookbooks/rvm/README.md +1459 -0
- data/cookbooks/rvm/Rakefile +18 -0
- data/cookbooks/rvm/attributes/.gitkeep +0 -0
- data/cookbooks/rvm/attributes/default.rb +68 -0
- data/cookbooks/rvm/attributes/gem_package.rb +23 -0
- data/cookbooks/rvm/attributes/vagrant.rb +23 -0
- data/cookbooks/rvm/libraries/chef_rvm_environment_helpers.rb +55 -0
- data/cookbooks/rvm/libraries/chef_rvm_gemset_helpers.rb +67 -0
- data/cookbooks/rvm/libraries/chef_rvm_recipe_helpers.rb +80 -0
- data/cookbooks/rvm/libraries/chef_rvm_ruby_helpers.rb +95 -0
- data/cookbooks/rvm/libraries/chef_rvm_set_helpers.rb +16 -0
- data/cookbooks/rvm/libraries/chef_rvm_shell_helpers.rb +57 -0
- data/cookbooks/rvm/libraries/chef_rvm_string_cache.rb +104 -0
- data/cookbooks/rvm/libraries/chef_rvm_string_helpers.rb +61 -0
- data/cookbooks/rvm/libraries/chef_rvm_version_helpers.rb +45 -0
- data/cookbooks/rvm/libraries/gem_package_monkeypatch.rb +34 -0
- data/cookbooks/rvm/libraries/provider_rvm_installation.rb +185 -0
- data/cookbooks/rvm/libraries/resource_rvm_installation.rb +103 -0
- data/cookbooks/rvm/libraries/rvm_chef_user_environment.rb +55 -0
- data/cookbooks/rvm/libraries/rvm_rubygems_package.rb +189 -0
- data/cookbooks/rvm/libraries/rvm_shell_chef_wrapper.rb +99 -0
- data/cookbooks/rvm/metadata.json +51 -0
- data/cookbooks/rvm/providers/default_ruby.rb +63 -0
- data/cookbooks/rvm/providers/environment.rb +78 -0
- data/cookbooks/rvm/providers/gemset.rb +118 -0
- data/cookbooks/rvm/providers/global_gem.rb +97 -0
- data/cookbooks/rvm/providers/ruby.rb +178 -0
- data/cookbooks/rvm/providers/shell.rb +121 -0
- data/cookbooks/rvm/providers/wrapper.rb +73 -0
- data/cookbooks/rvm/recipes/.gitkeep +0 -0
- data/cookbooks/rvm/recipes/default.rb +40 -0
- data/cookbooks/rvm/recipes/gem_package.rb +33 -0
- data/cookbooks/rvm/recipes/system.rb +37 -0
- data/cookbooks/rvm/recipes/system_install.rb +42 -0
- data/cookbooks/rvm/recipes/user.rb +43 -0
- data/cookbooks/rvm/recipes/user_install.rb +58 -0
- data/cookbooks/rvm/recipes/vagrant.rb +37 -0
- data/cookbooks/rvm/resources/default_ruby.rb +31 -0
- data/cookbooks/rvm/resources/environment.rb +31 -0
- data/cookbooks/rvm/resources/gem.rb +37 -0
- data/cookbooks/rvm/resources/gemset.rb +32 -0
- data/cookbooks/rvm/resources/global_gem.rb +34 -0
- data/cookbooks/rvm/resources/ruby.rb +32 -0
- data/cookbooks/rvm/resources/shell.rb +41 -0
- data/cookbooks/rvm/resources/wrapper.rb +34 -0
- data/cookbooks/rvm/templates/default/rvmrc.erb +14 -0
- data/cookbooks/rvm/templates/default/vagrant-chef-client-wrapper.erb +23 -0
- data/cookbooks/rvm/templates/default/vagrant-chef-solo-wrapper.erb +23 -0
- data/cookbooks/rvm/test/integration/data_bags/users/virgil1.json +4 -0
- data/cookbooks/rvm/test/integration/data_bags/users/virgil2.json +4 -0
- data/cookbooks/rvm/test/integration/data_bags/users/wigglebottom.json +3 -0
- data/cookbooks/rvm/test/integration/installs/bats/version_pinning.bats +13 -0
- data/cookbooks/rvm/test/integration/rubies/bats/_common.bash +16 -0
- data/cookbooks/rvm/test/integration/rubies/bats/verify_1.9.3.bats +9 -0
- data/cookbooks/rvm/test/integration/rubies/bats/verify_jruby.bats +12 -0
- data/cookbooks/rvm/test/integration/rubies/bats/verify_patch_support.bats +19 -0
- data/cookbooks/rvm/test/integration/rubies/bats/verify_ree.bats +9 -0
- data/cookbooks/rvm/test/integration/rubies/bats/verify_rubygems_version_support.bats +15 -0
- data/cookbooks/rvm/test/integration/stock_system_and_user/bats/system.bats +45 -0
- data/cookbooks/rvm/test/unit/libraries/provider_rvm_installation_spec.rb +220 -0
- data/cookbooks/rvm/test/unit/libraries/resource_rvm_installation_spec.rb +139 -0
- data/cookbooks/rvm/test/unit/spec_helper.rb +23 -0
- data/cookbooks/scratchify/.chef/knife.rb +9 -0
- data/cookbooks/scratchify/Berksfile +16 -0
- data/cookbooks/scratchify/Berksfile.lock +19 -0
- data/cookbooks/scratchify/LICENSE.txt +21 -0
- data/cookbooks/scratchify/README.md +41 -0
- data/cookbooks/scratchify/Thorfile +5 -0
- data/cookbooks/scratchify/bin/console +14 -0
- data/cookbooks/scratchify/bin/scratchify +6 -0
- data/cookbooks/scratchify/bin/setup +7 -0
- data/cookbooks/scratchify/chefignore +101 -0
- data/cookbooks/scratchify/data_bags/users/deploy.json +6 -0
- data/cookbooks/scratchify/environments/.gitkeep +0 -0
- data/cookbooks/scratchify/from-scratch.gemspec +36 -0
- data/cookbooks/scratchify/lib/from/scratch.rb +31 -0
- data/cookbooks/scratchify/lib/from/scratch/interviewer.rb +35 -0
- data/cookbooks/scratchify/lib/from/scratch/version.rb +3 -0
- data/cookbooks/scratchify/metadata.json +36 -0
- data/cookbooks/scratchify/nodes/normfood.ru.json +75 -0
- data/cookbooks/scratchify/recipes/default.rb +0 -0
- data/cookbooks/scratchify/roles/.gitkeep +0 -0
- data/cookbooks/scratchify/spec/from/scratch_spec.rb +11 -0
- data/cookbooks/scratchify/spec/spec_helper.rb +2 -0
- data/cookbooks/user/.gitignore +5 -0
- data/cookbooks/user/.kitchen.yml +46 -0
- data/cookbooks/user/.travis.yml +4 -0
- data/cookbooks/user/Berksfile +7 -0
- data/cookbooks/user/CHANGELOG.md +101 -0
- data/cookbooks/user/Gemfile +14 -0
- data/cookbooks/user/README.md +447 -0
- data/cookbooks/user/Rakefile +21 -0
- data/cookbooks/user/attributes/default.rb +50 -0
- data/cookbooks/user/libraries/matchers.rb +26 -0
- data/cookbooks/user/metadata.json +46 -0
- data/cookbooks/user/providers/account.rb +212 -0
- data/cookbooks/user/recipes/data_bag.rb +59 -0
- data/cookbooks/user/recipes/default.rb +18 -0
- data/cookbooks/user/resources/account.rb +41 -0
- data/cookbooks/user/templates/default/authorized_keys.erb +7 -0
- data/from-scratch.gemspec +33 -0
- data/lib/from-scratch.rb +25 -0
- data/lib/from-scratch/version.rb +3 -0
- data/metadata.rb +15 -0
- data/recipes/default.rb +0 -0
- data/templates/node.json.erb +31 -0
- data/templates/user.json.erb +6 -0
- metadata +330 -0
File without changes
|
File without changes
|
@@ -0,0 +1,46 @@
|
|
1
|
+
---
|
2
|
+
driver_plugin: vagrant
|
3
|
+
driver_config:
|
4
|
+
require_chef_omnibus: true
|
5
|
+
|
6
|
+
platforms:
|
7
|
+
- name: ubuntu-12.04
|
8
|
+
driver_config:
|
9
|
+
box: opscode-ubuntu-12.04
|
10
|
+
box_url: https://opscode-vm.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box
|
11
|
+
- name: ubuntu-10.04
|
12
|
+
driver_config:
|
13
|
+
box: opscode-ubuntu-10.04
|
14
|
+
box_url: https://opscode-vm.s3.amazonaws.com/vagrant/opscode_ubuntu-10.04_provisionerless.box
|
15
|
+
- name: centos-6.4
|
16
|
+
driver_config:
|
17
|
+
box: opscode-centos-6.4
|
18
|
+
box_url: https://opscode-vm.s3.amazonaws.com/vagrant/opscode_centos-6.4_provisionerless.box
|
19
|
+
- name: centos-5.9
|
20
|
+
driver_config:
|
21
|
+
box: opscode-centos-5.9
|
22
|
+
box_url: https://opscode-vm.s3.amazonaws.com/vagrant/opscode_centos-5.9_provisionerless.box
|
23
|
+
|
24
|
+
suites:
|
25
|
+
- name: lwrp
|
26
|
+
run_list:
|
27
|
+
- recipe[user_test::lwrp]
|
28
|
+
attributes: {}
|
29
|
+
- name: data_bag
|
30
|
+
run_list:
|
31
|
+
- recipe[user::data_bag]
|
32
|
+
attributes:
|
33
|
+
users:
|
34
|
+
- hsolo
|
35
|
+
- lando
|
36
|
+
- luke.skywalker
|
37
|
+
- name: data_bag_no_users
|
38
|
+
run_list:
|
39
|
+
- recipe[user::data_bag]
|
40
|
+
attributes: {}
|
41
|
+
- name: home_dir_mode
|
42
|
+
run_list:
|
43
|
+
- recipe[user_test::lwrp]
|
44
|
+
attributes:
|
45
|
+
user:
|
46
|
+
home_dir_mode: "0700"
|
@@ -0,0 +1,101 @@
|
|
1
|
+
## 0.3.0 / 2012-07-24
|
2
|
+
|
3
|
+
### Improvements
|
4
|
+
|
5
|
+
* Rename data_bag attribute to data_bag_name which works with bag_config cookbook. ([@fnichol][])
|
6
|
+
|
7
|
+
|
8
|
+
## 0.2.15 / 2012-07-24
|
9
|
+
|
10
|
+
### Improvements
|
11
|
+
|
12
|
+
* Add :user_array_node_attr attribute which can override the location of the users' array in your node's attribute hash. ([@fnichol][])
|
13
|
+
|
14
|
+
|
15
|
+
## 0.2.14 / 2012-07-24
|
16
|
+
|
17
|
+
### Improvements
|
18
|
+
|
19
|
+
* Pull request [#11][], Issue [#10][]: Groups management (not only gid). ([@smaftoul][])
|
20
|
+
|
21
|
+
|
22
|
+
## 0.2.12 / 2012-05-01
|
23
|
+
|
24
|
+
### Bug fixes
|
25
|
+
|
26
|
+
* user_account LWRP now notifies when updated (FC017). ([@fnichol][])
|
27
|
+
* Add plaform equivalents in default attrs (FC024). ([@fnichol][])
|
28
|
+
|
29
|
+
### Improvements
|
30
|
+
|
31
|
+
* Add unit testing for user_account resource. ([@fnichol][])
|
32
|
+
* Add unit testing for attributes. ([@fnichol][])
|
33
|
+
* Add TravisCI to run test suite and Foodcritic linter. ([@fnichol][])
|
34
|
+
* Reorganize README with section links. ([@fnichol][])
|
35
|
+
* Pull request [#7][]: Fix semantic issues in README. ([@nathenharvey][])
|
36
|
+
|
37
|
+
|
38
|
+
## 0.2.10 / 2012-01-20
|
39
|
+
|
40
|
+
### Bug fixes
|
41
|
+
|
42
|
+
* Pull request [#6][]: Fix ordering of user deletion in :remove action. ([@nessche][])
|
43
|
+
|
44
|
+
### Improvements
|
45
|
+
|
46
|
+
* Issue [#4][]: Support Ruby 1.8.6 (no #end_with?). ([@fnichol][])
|
47
|
+
* Issue [#3][]: Mention dependency on ruby-shadow if managing password. ([@fnichol][])
|
48
|
+
* Issue [#5][]: Clarify iteration through node['users'] in recipe[user::data_bag]. ([@fnichol][])
|
49
|
+
|
50
|
+
|
51
|
+
## 0.2.8 / 2012-01-20
|
52
|
+
|
53
|
+
### Improvements
|
54
|
+
|
55
|
+
* Handle user names with periods in them. ([@fnichol][])
|
56
|
+
|
57
|
+
|
58
|
+
## 0.2.6 / 2011-10-18
|
59
|
+
|
60
|
+
### Improvements
|
61
|
+
|
62
|
+
* Data bag item attribute `username` can override `id` for users with illegal data bag characters. ([@fnichol])
|
63
|
+
|
64
|
+
|
65
|
+
## 0.2.4 / 2011-09-19
|
66
|
+
|
67
|
+
### Bug fixes
|
68
|
+
|
69
|
+
* Fix data bag missing error message. ([@fnichol][])
|
70
|
+
|
71
|
+
|
72
|
+
## 0.2.2 / 2011-09-14
|
73
|
+
|
74
|
+
### Bug fixes
|
75
|
+
|
76
|
+
* Issue [#2][]: user_account resource should accept String or Integer for uid attribute. ([@fnichol][])
|
77
|
+
* Add home and shell defaults for SuSE. ([@fnichol][])
|
78
|
+
|
79
|
+
### Improvements
|
80
|
+
|
81
|
+
* Add installation instructions to README. ([@fnichol][])
|
82
|
+
* Add fallback default `home_root` attribute value of "/home". ([@fnichol][])
|
83
|
+
|
84
|
+
|
85
|
+
## 0.2.0 / 2011-08-12
|
86
|
+
|
87
|
+
The initial release.
|
88
|
+
|
89
|
+
<!--- The following link definition list is generated by PimpMyChangelog --->
|
90
|
+
[#2]: https://github.com/fnichol/chef-user/issues/2
|
91
|
+
[#3]: https://github.com/fnichol/chef-user/issues/3
|
92
|
+
[#4]: https://github.com/fnichol/chef-user/issues/4
|
93
|
+
[#5]: https://github.com/fnichol/chef-user/issues/5
|
94
|
+
[#6]: https://github.com/fnichol/chef-user/issues/6
|
95
|
+
[#7]: https://github.com/fnichol/chef-user/issues/7
|
96
|
+
[#10]: https://github.com/fnichol/chef-user/issues/10
|
97
|
+
[#11]: https://github.com/fnichol/chef-user/issues/11
|
98
|
+
[@fnichol]: https://github.com/fnichol
|
99
|
+
[@nathenharvey]: https://github.com/nathenharvey
|
100
|
+
[@nessche]: https://github.com/nessche
|
101
|
+
[@smaftoul]: https://github.com/smaftoul
|
@@ -0,0 +1,14 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
gem 'rake'
|
4
|
+
gem 'minitest', '~> 4.7'
|
5
|
+
gem 'foodcritic'
|
6
|
+
|
7
|
+
# allow CI to override the version of Chef for matrix testing
|
8
|
+
gem 'chef', (ENV['CHEF_VERSION'] || '>= 0.10.10')
|
9
|
+
|
10
|
+
group :integration do
|
11
|
+
gem 'berkshelf'
|
12
|
+
gem 'test-kitchen', '~> 1.0.0.alpha.7'
|
13
|
+
gem 'kitchen-vagrant'
|
14
|
+
end
|
@@ -0,0 +1,447 @@
|
|
1
|
+
# <a name="title"></a> User Chef Cookbook
|
2
|
+
|
3
|
+
[![Build Status](https://secure.travis-ci.org/fnichol/chef-user.png?branch=master)](http://travis-ci.org/fnichol/chef-user)
|
4
|
+
|
5
|
+
## <a name="description"></a> Description
|
6
|
+
|
7
|
+
A convenient Chef LWRP to manage user accounts and SSH keys. This is **not**
|
8
|
+
the Opscode *users* cookbook.
|
9
|
+
|
10
|
+
* Website: http://fnichol.github.io/chef-user/
|
11
|
+
* Opscode Community Site: http://community.opscode.com/cookbooks/user
|
12
|
+
* Source Code: https://github.com/fnichol/chef-user
|
13
|
+
|
14
|
+
## <a name="usage"></a> Usage
|
15
|
+
|
16
|
+
Simply include this cookbook as a dependency in `metadata.rb` and the `user_account`
|
17
|
+
resource will be available. Example:
|
18
|
+
|
19
|
+
# In your_cookbook/metadata.rb
|
20
|
+
depends 'user'
|
21
|
+
|
22
|
+
# In your_cookbook/recipes/default.rb
|
23
|
+
user_account 'hsolo' do
|
24
|
+
ssh_keygen true
|
25
|
+
end
|
26
|
+
|
27
|
+
To use `recipe[user::data_bag]`, include it in your run\_list and have a
|
28
|
+
data bag called `"users"` with an item like the following:
|
29
|
+
|
30
|
+
{
|
31
|
+
"id" : "hsolo",
|
32
|
+
"comment" : "Han Solo",
|
33
|
+
"home" : "/opt/hoth/hsolo",
|
34
|
+
"groups" : ["admin", "www-data"],
|
35
|
+
"ssh_keys" : ["123...", "456..."]
|
36
|
+
}
|
37
|
+
|
38
|
+
or a user to be removed:
|
39
|
+
|
40
|
+
{
|
41
|
+
"id" : "lando",
|
42
|
+
"action" : "remove"
|
43
|
+
}
|
44
|
+
|
45
|
+
If you have a username containing a period, use a dash in the data bag item
|
46
|
+
and set a `username` attribute:
|
47
|
+
|
48
|
+
{
|
49
|
+
"id" : "luke-skywalker",
|
50
|
+
"username" : "luke.skywalker",
|
51
|
+
"action" : ["create", "lock"]
|
52
|
+
}
|
53
|
+
|
54
|
+
The data bag recipe will iterate through a list of usernames defined in
|
55
|
+
`node['users']` (by default) and attempt to pull in the user's information
|
56
|
+
from the data bag item. In other words, having:
|
57
|
+
|
58
|
+
node['users'] = ['hsolo', 'lando', 'luke.skywalker']
|
59
|
+
|
60
|
+
will set up the `hsolo` user information and not use the `lando` user
|
61
|
+
information.
|
62
|
+
|
63
|
+
## <a name="requirements"></a> Requirements
|
64
|
+
|
65
|
+
### <a name="requirements-chef"></a> Chef
|
66
|
+
|
67
|
+
Tested on 0.10.8 but newer and older version should work just fine. File an
|
68
|
+
[issue][issues] if this isn't the case.
|
69
|
+
|
70
|
+
### <a name="requirements-platform"></a> Platform
|
71
|
+
|
72
|
+
The following platforms have been tested with this cookbook, meaning that the
|
73
|
+
recipes run on these platforms without error:
|
74
|
+
|
75
|
+
* ubuntu
|
76
|
+
* debian
|
77
|
+
* mac_os_x
|
78
|
+
|
79
|
+
### <a name="requirements-cookbooks"></a> Cookbooks
|
80
|
+
|
81
|
+
There are **no** external cookbook dependencies.
|
82
|
+
|
83
|
+
## <a name="installation"></a> Installation
|
84
|
+
|
85
|
+
Depending on the situation and use case there are several ways to install
|
86
|
+
this cookbook. All the methods listed below assume a tagged version release
|
87
|
+
is the target, but omit the tags to get the head of development. A valid
|
88
|
+
Chef repository structure like the [Opscode repo][chef_repo] is also assumed.
|
89
|
+
|
90
|
+
### <a name="installation-platform"></a> From the Community Site
|
91
|
+
|
92
|
+
To install this cookbook from the Community Site, use the *knife* command:
|
93
|
+
|
94
|
+
knife cookbook site install user
|
95
|
+
|
96
|
+
### <a name="installation-berkshelf"></a> Using Berkshelf
|
97
|
+
|
98
|
+
[Berkshelf][berkshelf] is a cookbook dependency manager and development
|
99
|
+
workflow assistant. To install Berkshelf:
|
100
|
+
|
101
|
+
cd chef-repo
|
102
|
+
gem install berkshelf
|
103
|
+
berks init
|
104
|
+
|
105
|
+
To use the Community Site version:
|
106
|
+
|
107
|
+
echo "cookbook 'user'" >> Berksfile
|
108
|
+
berks install
|
109
|
+
|
110
|
+
Or to reference the Git version:
|
111
|
+
|
112
|
+
repo="fnichol/chef-user"
|
113
|
+
latest_release=$(curl -s https://api.github.com/repos/$repo/git/refs/tags \
|
114
|
+
| ruby -rjson -e '
|
115
|
+
j = JSON.parse(STDIN.read);
|
116
|
+
puts j.map { |t| t["ref"].split("/").last }.sort.last
|
117
|
+
')
|
118
|
+
cat >> Berksfile <<END_OF_BERKSFILE
|
119
|
+
cookbook 'user',
|
120
|
+
:git => 'git://github.com/$repo.git', :branch => '$latest_release'
|
121
|
+
END_OF_BERKSFILE
|
122
|
+
berks install
|
123
|
+
|
124
|
+
### <a name="installation-librarian"></a> Using Librarian-Chef
|
125
|
+
|
126
|
+
[Librarian-Chef][librarian] is a bundler for your Chef cookbooks.
|
127
|
+
To install Librarian-Chef:
|
128
|
+
|
129
|
+
cd chef-repo
|
130
|
+
gem install librarian
|
131
|
+
librarian-chef init
|
132
|
+
|
133
|
+
To use the Opscode platform version:
|
134
|
+
|
135
|
+
echo "cookbook 'user'" >> Cheffile
|
136
|
+
librarian-chef install
|
137
|
+
|
138
|
+
Or to reference the Git version:
|
139
|
+
|
140
|
+
repo="fnichol/chef-user"
|
141
|
+
latest_release=$(curl -s https://api.github.com/repos/$repo/git/refs/tags \
|
142
|
+
| ruby -rjson -e '
|
143
|
+
j = JSON.parse(STDIN.read);
|
144
|
+
puts j.map { |t| t["ref"].split("/").last }.sort.last
|
145
|
+
')
|
146
|
+
cat >> Cheffile <<END_OF_CHEFFILE
|
147
|
+
cookbook 'user',
|
148
|
+
:git => 'git://github.com/$repo.git', :ref => '$latest_release'
|
149
|
+
END_OF_CHEFFILE
|
150
|
+
librarian-chef install
|
151
|
+
|
152
|
+
## <a name="recipes"></a> Recipes
|
153
|
+
|
154
|
+
### <a name="recipes-default"></a> default
|
155
|
+
|
156
|
+
This recipe is a no-op and does nothing.
|
157
|
+
|
158
|
+
### <a name="recipes-data-bag"></a> data_bag
|
159
|
+
|
160
|
+
Processes a list of users with data drawn from a data bag. The default data bag
|
161
|
+
is `users` and the list of user accounts to create on this node is set on
|
162
|
+
`node['users']`.
|
163
|
+
|
164
|
+
## <a name="attributes"></a> Attributes
|
165
|
+
|
166
|
+
### <a name="attributes-home-root"></a> home_root
|
167
|
+
|
168
|
+
The default parent path of a user's home directory. Each resource can override
|
169
|
+
this value which varies by platform. Generally speaking, the default value is
|
170
|
+
`"/home"`.
|
171
|
+
|
172
|
+
### <a name="attributes-default-shell"></a> default_shell
|
173
|
+
|
174
|
+
The default user shell given to a user. Each resource can override this value
|
175
|
+
which varies by platform. Generally speaking, the default value is
|
176
|
+
`"/bin/bash"`.
|
177
|
+
|
178
|
+
### <a name="attributes-home-dir-mode"></a> home_dir_mode
|
179
|
+
|
180
|
+
The default Unix permissions applied to a user's home directory.
|
181
|
+
|
182
|
+
The default is `"2755"`.
|
183
|
+
|
184
|
+
### <a name="attributes-manage-home"></a> manage_home
|
185
|
+
|
186
|
+
Whether of not to manage the home directory of a user by default. Each resource
|
187
|
+
can override this value. The are 2 valid states:
|
188
|
+
|
189
|
+
* `"true"`, `true`, or `"yes"`: will manage the user's home directory.
|
190
|
+
* `"false"`, `false`, or `"no"`: will not manage the user's home directory.
|
191
|
+
|
192
|
+
The default is `true`.
|
193
|
+
|
194
|
+
### <a name="attributes-non-unique"></a> non_unique
|
195
|
+
|
196
|
+
Whether of not to allow the creation of a user account with a duplicate UID.
|
197
|
+
Each resource can override this value. The are 2 valid states:
|
198
|
+
|
199
|
+
* `"true"`, `true`, or `"yes"`: will allow duplicate UIDs.
|
200
|
+
* `"false"`, `false`, or `"no"`: will not allow duplicate UIDs.
|
201
|
+
|
202
|
+
The default is `false`.
|
203
|
+
|
204
|
+
### <a name="attributes-create-user-group"></a> create_group
|
205
|
+
|
206
|
+
Whether or not to to create a group with the same name as the user by default.
|
207
|
+
Each resource can override this value. The are 2 valid states:
|
208
|
+
|
209
|
+
* `"true"`, `true`, or `"yes"`: will create a group for the user by default.
|
210
|
+
* `"false"`, `false`, or `"no"`: will not create a group for the user by default.
|
211
|
+
|
212
|
+
The default is `true`.
|
213
|
+
|
214
|
+
### <a name="attributes-ssh-keygen"></a> ssh_keygen
|
215
|
+
|
216
|
+
Whether or not to generate an SSH keypair for the user by default. Each
|
217
|
+
resource can override this value. There are 2 valid states:
|
218
|
+
|
219
|
+
* `"true"`, `true`, or `"yes"`: will generate an SSH keypair when the account
|
220
|
+
is created.
|
221
|
+
* `"false"`, `false`, or `"no"`: will not generate an SSH keypair when the account
|
222
|
+
is created.
|
223
|
+
|
224
|
+
The default is `true`.
|
225
|
+
|
226
|
+
### <a name="attributes-data-bag-name"></a> data_bag_name
|
227
|
+
|
228
|
+
The data bag name containing a group of user account information. This is used
|
229
|
+
by the `data_bag` recipe to use as a database of user accounts.
|
230
|
+
|
231
|
+
The default is `"users"`.
|
232
|
+
|
233
|
+
### <a name="attributes-user-array-node-attr"></a> user_array_node_attr
|
234
|
+
|
235
|
+
The node attributes containing an array of users to be managed. If a nested
|
236
|
+
hash in the node's attributes is required, then use a `/` between subhashes.
|
237
|
+
For example, if the users' array is stored in `node['system']['accounts']`),
|
238
|
+
then set `node['user']['user_array_node_attr']` to `"system/accounts"`.
|
239
|
+
|
240
|
+
The default is `"users"`.
|
241
|
+
|
242
|
+
## <a name="lwrps"></a> Resources and Providers
|
243
|
+
|
244
|
+
### <a name="lwrps-ua"></a> user_account
|
245
|
+
|
246
|
+
**Note:** in order to use the `password` attribute, you must have the
|
247
|
+
[ruby-shadow gem][ruby-shadow_gem] installed. On Debian/Ubuntu you can get
|
248
|
+
this by installing the "libshadow-ruby1.8" package.
|
249
|
+
|
250
|
+
### <a name="lwrps-ua-actions"></a> Actions
|
251
|
+
|
252
|
+
<table>
|
253
|
+
<thead>
|
254
|
+
<tr>
|
255
|
+
<th>Action</th>
|
256
|
+
<th>Description</th>
|
257
|
+
<th>Default</th>
|
258
|
+
</tr>
|
259
|
+
</thead>
|
260
|
+
<tbody>
|
261
|
+
<tr>
|
262
|
+
<td>create</td>
|
263
|
+
<td>
|
264
|
+
Create the user, its home directory, <code>.ssh/authorized_keys</code>,
|
265
|
+
and <code>.ssh/{id_rsa,id_rsa.pub}</code>.
|
266
|
+
</td>
|
267
|
+
<td>Yes</td>
|
268
|
+
</tr>
|
269
|
+
<tr>
|
270
|
+
<td>remove</td>
|
271
|
+
<td>Remove the user account.</td>
|
272
|
+
<td> </td>
|
273
|
+
</tr>
|
274
|
+
<tr>
|
275
|
+
<td>modify</td>
|
276
|
+
<td>Modify the user account.</td>
|
277
|
+
<td> </td>
|
278
|
+
</tr>
|
279
|
+
<tr>
|
280
|
+
<td>manage</td>
|
281
|
+
<td>Manage the user account.</td>
|
282
|
+
<td> </td>
|
283
|
+
</tr>
|
284
|
+
<tr>
|
285
|
+
<td>lock</td>
|
286
|
+
<td>Lock the user's password.</td>
|
287
|
+
<td> </td>
|
288
|
+
</tr>
|
289
|
+
<tr>
|
290
|
+
<td>unlock</td>
|
291
|
+
<td>Unlock the user's password.</td>
|
292
|
+
<td> </td>
|
293
|
+
</tr>
|
294
|
+
</tbody>
|
295
|
+
</table>
|
296
|
+
|
297
|
+
### <a name="lwrps-ua-attributes"></a> Attributes
|
298
|
+
|
299
|
+
<table>
|
300
|
+
<thead>
|
301
|
+
<tr>
|
302
|
+
<th>Attribute</th>
|
303
|
+
<th>Description</th>
|
304
|
+
<th>Default Value</th>
|
305
|
+
</tr>
|
306
|
+
</thead>
|
307
|
+
<tbody>
|
308
|
+
<tr>
|
309
|
+
<td>username</td>
|
310
|
+
<td><b>Name attribute:</b> The name of the user.</td>
|
311
|
+
<td><code>nil</code></td>
|
312
|
+
</tr>
|
313
|
+
<tr>
|
314
|
+
<td>comment</td>
|
315
|
+
<td>Gecos/Comment field.</td>
|
316
|
+
<td><code>nil</code></td>
|
317
|
+
</tr>
|
318
|
+
<tr>
|
319
|
+
<td>uid</td>
|
320
|
+
<td>The numeric user id.</td>
|
321
|
+
<td><code>nil</code></td>
|
322
|
+
</tr>
|
323
|
+
<tr>
|
324
|
+
<td>gid</td>
|
325
|
+
<td>The primary group id.</td>
|
326
|
+
<td><code>nil</code></td>
|
327
|
+
</tr>
|
328
|
+
<tr>
|
329
|
+
<td>groups</td>
|
330
|
+
<td>Array of other groups this user should be a member of.</td>
|
331
|
+
<td><code>nil</code></td>
|
332
|
+
</tr>
|
333
|
+
<tr>
|
334
|
+
<td>home</td>
|
335
|
+
<td>Home directory location.</td>
|
336
|
+
<td><code>"#{node['user']['home_root']}/#{username}</code></td>
|
337
|
+
</tr>
|
338
|
+
<tr>
|
339
|
+
<td>shell</td>
|
340
|
+
<td>The login shell.</td>
|
341
|
+
<td><code>node['user']['default_shell']</code></td>
|
342
|
+
</tr>
|
343
|
+
<tr>
|
344
|
+
<td>password</td>
|
345
|
+
<td>Shadow hash of password.</td>
|
346
|
+
<td><code>nil</code></td>
|
347
|
+
</tr>
|
348
|
+
<tr>
|
349
|
+
<td>system_user</td>
|
350
|
+
<td>Whether or not to create a system user.</td>
|
351
|
+
<td><code>false</code></td>
|
352
|
+
</tr>
|
353
|
+
<tr>
|
354
|
+
<td>manage_home</td>
|
355
|
+
<td>Whether or not to manage the home directory.</td>
|
356
|
+
<td><code>true</code></td>
|
357
|
+
</tr>
|
358
|
+
<tr>
|
359
|
+
<td>non_unique</td>
|
360
|
+
<td>Whether or not to allow the creation of a user account with a duplicate UID.</td>
|
361
|
+
<td><code>false</code></td>
|
362
|
+
</tr>
|
363
|
+
<tr>
|
364
|
+
<td>create_group</td>
|
365
|
+
<td>
|
366
|
+
Whether or not to to create a group with the same name as the user.
|
367
|
+
</td>
|
368
|
+
<td><code>node['user']['create_group']</code></td>
|
369
|
+
</tr>
|
370
|
+
<tr>
|
371
|
+
<td>ssh_keys</td>
|
372
|
+
<td>
|
373
|
+
A <b>String</b> or <b>Array</b> of SSH public keys to populate the
|
374
|
+
user's <code>.ssh/authorized_keys</code> file.
|
375
|
+
</td>
|
376
|
+
<td><code>[]</code></td>
|
377
|
+
</tr>
|
378
|
+
<tr>
|
379
|
+
<td>ssh_keygen</td>
|
380
|
+
<td>Whether or not to generate an SSH keypair for the user.</td>
|
381
|
+
<td><code>node['user']['ssh_keygen']</code></td>
|
382
|
+
</tr>
|
383
|
+
<tr>
|
384
|
+
<td>groups</td>
|
385
|
+
<td>An Array of groups to which to add the user.</td>
|
386
|
+
<td><code>[]</code></td>
|
387
|
+
</tr>
|
388
|
+
</tbody>
|
389
|
+
</table>
|
390
|
+
|
391
|
+
#### <a name="lwrps-ua-examples"></a> Examples
|
392
|
+
|
393
|
+
##### Creating a User Account
|
394
|
+
|
395
|
+
user_account 'hsolo' do
|
396
|
+
comment 'Han Solo'
|
397
|
+
ssh_keys ['3dc348d9af8027df7b9c...', '2154d3734d609eb5c452...']
|
398
|
+
home '/opt/hoth/hsolo'
|
399
|
+
end
|
400
|
+
|
401
|
+
##### Creating and Locking a User Account
|
402
|
+
|
403
|
+
user_account 'lando' do
|
404
|
+
action [:create, :lock]
|
405
|
+
end
|
406
|
+
|
407
|
+
##### Removing a User account
|
408
|
+
|
409
|
+
user_account 'obiwan' do
|
410
|
+
action :remove
|
411
|
+
end
|
412
|
+
|
413
|
+
## <a name="development"></a> Development
|
414
|
+
|
415
|
+
* Source hosted at [GitHub][repo]
|
416
|
+
* Report issues/Questions/Feature requests on [GitHub Issues][issues]
|
417
|
+
|
418
|
+
Pull requests are very welcome! Make sure your patches are well tested.
|
419
|
+
Ideally create a topic branch for every separate change you make.
|
420
|
+
|
421
|
+
## <a name="license"></a> License and Author
|
422
|
+
|
423
|
+
Author:: [Fletcher Nichol][fnichol] (<fnichol@nichol.ca>) [![endorse](http://api.coderwall.com/fnichol/endorsecount.png)](http://coderwall.com/fnichol)
|
424
|
+
|
425
|
+
Copyright 2011, Fletcher Nichol
|
426
|
+
|
427
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
428
|
+
you may not use this file except in compliance with the License.
|
429
|
+
You may obtain a copy of the License at
|
430
|
+
|
431
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
432
|
+
|
433
|
+
Unless required by applicable law or agreed to in writing, software
|
434
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
435
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
436
|
+
See the License for the specific language governing permissions and
|
437
|
+
limitations under the License.
|
438
|
+
|
439
|
+
[berkshelf]: http://berkshelf.com/
|
440
|
+
[chef_repo]: https://github.com/opscode/chef-repo
|
441
|
+
[cheffile]: https://github.com/applicationsonline/librarian/blob/master/lib/librarian/chef/templates/Cheffile
|
442
|
+
[kgc]: https://github.com/websterclay/knife-github-cookbooks#readme
|
443
|
+
[librarian]: https://github.com/applicationsonline/librarian#readme
|
444
|
+
[ruby-shadow_gem]: https://rubygems.org/gems/ruby-shadow
|
445
|
+
|
446
|
+
[repo]: https://github.com/fnichol/chef-user
|
447
|
+
[issues]: https://github.com/fnichol/chef-user/issues
|