solokit 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ 0.1.3
2
+
3
+ Updated the apt cookbook.
4
+
1
5
  0.1.2
2
6
 
3
7
  Major speed improvment by reducing the number of ssh logins.
@@ -0,0 +1,109 @@
1
+ Description
2
+ ===========
3
+
4
+ Configures various APT components on Debian-like systems. Also includes a LWRP.
5
+
6
+ Recipes
7
+ =======
8
+
9
+ default
10
+ -------
11
+ The default recipe runs apt-get update during the Compile Phase of the Chef run to ensure that the system's package cache is updated with the latest. It is recommended that this recipe appear first in a node's run list (directly or through a role) to ensure that when installing packages, Chef will be able to download the latest version available on the remote APT repository.
12
+
13
+ This recipe also sets up a local cache directory for preseeding packages.
14
+
15
+ cacher
16
+ ------
17
+ Installs the apt-cacher package and service so the system can provide APT caching. You can check the usage report at http://{hostname}:3142/report. The cacher recipe includes the `cacher-client` recipe, so it helps seed itself.
18
+
19
+ cacher-client
20
+ -------------
21
+ Configures the node to use the apt-cacher server as a client.
22
+
23
+ Resources/Providers
24
+ ===================
25
+
26
+ This LWRP provides an easy way to manage additional APT repositories.
27
+
28
+ # Actions
29
+
30
+ - :add: creates a repository file and builds the repository listing
31
+ - :remove: removes the repository file
32
+
33
+ # Attribute Parameters
34
+
35
+ - repo_name: name attribute. The name of the channel to discover
36
+ - uri: the base of the Debian distribution
37
+ - distribution: this is usually your release's codename...ie something like `karmic`, `lucid` or `maverick`
38
+ - components: package groupings..when it doubt use `main`
39
+ - deb_src: whether or not to add the repository as a source repo as well
40
+ - key_server: the GPG keyserver where the key for the repo should be retrieved
41
+ - key: if a `key_server` is provided, this is assumed to be the fingerprint, otherwise it is the URI to the GPG key for the repo
42
+
43
+ # Example
44
+
45
+ # add the Zenoss repo
46
+ apt_repository "zenoss" do
47
+ uri "http://dev.zenoss.org/deb"
48
+ components ["main","stable"]
49
+ action :add
50
+ end
51
+
52
+ # add the Nginx PPA; grab key from keyserver
53
+ apt_repository "nginx-php" do
54
+ uri "http://ppa.launchpad.net/nginx/php5/ubuntu"
55
+ distribution node['lsb']['codename']
56
+ components ["main"]
57
+ keyserver "keyserver.ubuntu.com"
58
+ key "C300EE8C"
59
+ action :add
60
+ end
61
+
62
+ # add the Cloudkick Repo
63
+ apt_repository "cloudkick" do
64
+ uri "http://packages.cloudkick.com/ubuntu"
65
+ distribution node['lsb']['codename']
66
+ components ["main"]
67
+ key "http://packages.cloudkick.com/cloudkick.packages.key"
68
+ action :add
69
+ end
70
+
71
+ # remove Zenoss repo
72
+ apt_repository "zenoss" do
73
+ action :remove
74
+ end
75
+
76
+ Usage
77
+ =====
78
+
79
+ Put `recipe[apt]` first in the run list. If you have other recipes that you want to use to configure how apt behaves, like new sources, notify the execute resource to run, e.g.:
80
+
81
+ template "/etc/apt/sources.list.d/my_apt_sources.list" do
82
+ notifies :run, resources(:execute => "apt-get update"), :immediately
83
+ end
84
+
85
+ The above will run during execution phase since it is a normal template resource, and should appear before other package resources that need the sources in the template.
86
+
87
+ Put `recipe[apt::cacher]` in the run_list for a server to provide APT caching and add `recipe[apt::cacher-client]` on the rest of the Debian-based nodes to take advantage of the caching server.
88
+
89
+ License and Author
90
+ ==================
91
+
92
+ Author:: Joshua Timberman (<joshua@opscode.com>)
93
+ Author:: Matt Ray (<matt@opscode.com>)
94
+ Author:: Seth Chisamore (<schisamo@opscode.com>)
95
+
96
+ Copyright 2009-2011 Opscode, Inc.
97
+
98
+ Licensed under the Apache License, Version 2.0 (the "License");
99
+ you may not use this file except in compliance with the License.
100
+ You may obtain a copy of the License at
101
+
102
+ http://www.apache.org/licenses/LICENSE-2.0
103
+
104
+ Unless required by applicable law or agreed to in writing, software
105
+ distributed under the License is distributed on an "AS IS" BASIS,
106
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
107
+ See the License for the specific language governing permissions and
108
+ limitations under the License.
109
+
@@ -1,10 +1,12 @@
1
1
  maintainer "Opscode, Inc."
2
2
  maintainer_email "cookbooks@opscode.com"
3
3
  license "Apache 2.0"
4
- description "Configures apt and apt services"
5
- version "0.8"
4
+ description "Configures apt and apt services and an LWRP for managing apt repositories"
5
+ long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
6
+ version "1.1.1"
7
+ recipe "apt", "Runs apt-get update during compile phase and sets up preseed directories"
6
8
  recipe "apt::cacher", "Set up an APT cache"
7
- recipe "apt::proxy", "Set up an APT proxy"
9
+ recipe "apt::cacher-client", "Client for the apt::cacher server"
8
10
 
9
11
  %w{ ubuntu debian }.each do |os|
10
12
  supports os
@@ -0,0 +1,72 @@
1
+ #
2
+ # Cookbook Name:: apt
3
+ # Provider:: repository
4
+ #
5
+ # Copyright 2010-2011, Opscode, Inc.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ action :add do
21
+ unless ::File.exists?("/etc/apt/sources.list.d/#{new_resource.repo_name}-source.list")
22
+ Chef::Log.info "Adding #{new_resource.repo_name} repository to /etc/apt/sources.list.d/#{new_resource.repo_name}-source.list"
23
+ # add key
24
+ if new_resource.keyserver && new_resource.key
25
+ execute "install-key #{new_resource.key}" do
26
+ command "apt-key adv --keyserver #{new_resource.keyserver} --recv #{new_resource.key}"
27
+ action :nothing
28
+ end.run_action(:run)
29
+ elsif new_resource.key && (new_resource.key =~ /http/)
30
+ key_name = new_resource.key.split(/\//).last
31
+ remote_file "#{Chef::Config[:file_cache_path]}/#{key_name}" do
32
+ source new_resource.key
33
+ mode "0644"
34
+ action :nothing
35
+ end.run_action(:create_if_missing)
36
+ execute "install-key #{key_name}" do
37
+ command "apt-key add #{Chef::Config[:file_cache_path]}/#{key_name}"
38
+ action :nothing
39
+ end.run_action(:run)
40
+ end
41
+ # build our listing
42
+ repository = "deb"
43
+ repository = "deb-src" if new_resource.deb_src
44
+ repository = "# Created by the Chef apt_repository LWRP\n" + repository
45
+ repository += " #{new_resource.uri}"
46
+ repository += " #{new_resource.distribution}"
47
+ new_resource.components.each {|component| repository += " #{component}"}
48
+ # write out the file, replace it if it already exists
49
+ file "/etc/apt/sources.list.d/#{new_resource.repo_name}-source.list" do
50
+ owner "root"
51
+ group "root"
52
+ mode 0644
53
+ content repository + "\n"
54
+ action :nothing
55
+ end.run_action(:create)
56
+ execute "update package index" do
57
+ command "apt-get update"
58
+ action :nothing
59
+ end.run_action(:run)
60
+ new_resource.updated_by_last_action(true)
61
+ end
62
+ end
63
+
64
+ action :remove do
65
+ if ::File.exists?("/etc/apt/sources.list.d/#{new_resource.repo_name}-source.list")
66
+ Chef::Log.info "Removing #{new_resource.repo_name} repository from /etc/apt/sources.list.d/"
67
+ file "/etc/apt/sources.list.d/#{new_resource.repo_name}-source.list" do
68
+ action :delete
69
+ end
70
+ new_resource.updated_by_last_action(true)
71
+ end
72
+ end
@@ -0,0 +1,37 @@
1
+ #
2
+ # Cookbook Name:: apt
3
+ # Recipe:: cacher-client
4
+ #
5
+ # Copyright 2011, Opscode, Inc.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ servers = search(:node, 'recipes:apt\:\:cacher') || []
21
+ if servers.length > 0
22
+ Chef::Log.info("apt-cacher server found on #{servers[0]}.")
23
+ proxy = "Acquire::http::Proxy \"http://#{servers[0].ipaddress}:3142\";"
24
+ file "/etc/apt/apt.conf.d/01proxy" do
25
+ owner "root"
26
+ group "root"
27
+ mode "0644"
28
+ content proxy
29
+ action :create
30
+ end
31
+ else
32
+ Chef::Log.info("No apt-cacher server found.")
33
+ file "/etc/apt/apt.conf.d/01proxy" do
34
+ action :delete
35
+ only_if {File.exists?("/etc/apt/apt.conf.d/01proxy")}
36
+ end
37
+ end
@@ -2,7 +2,7 @@
2
2
  # Cookbook Name:: apt
3
3
  # Recipe:: cacher
4
4
  #
5
- # Copyright 2008-2009, Opscode, Inc.
5
+ # Copyright 2008-2011, Opscode, Inc.
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
8
8
  # you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@ service "apt-cacher" do
25
25
  action [ :enable, :start ]
26
26
  end
27
27
 
28
- remote_file "/etc/apt-cacher/apt-cacher.conf" do
28
+ cookbook_file "/etc/apt-cacher/apt-cacher.conf" do
29
29
  source "apt-cacher.conf"
30
30
  owner "root"
31
31
  group "root"
@@ -33,10 +33,13 @@ remote_file "/etc/apt-cacher/apt-cacher.conf" do
33
33
  notifies :restart, resources(:service => "apt-cacher")
34
34
  end
35
35
 
36
- remote_file "/etc/default/apt-cacher" do
36
+ cookbook_file "/etc/default/apt-cacher" do
37
37
  source "apt-cacher"
38
38
  owner "root"
39
39
  group "root"
40
40
  mode 0644
41
41
  notifies :restart, resources(:service => "apt-cacher")
42
42
  end
43
+
44
+ #this will help seed the proxy
45
+ include_recipe "apt::cacher-client"
@@ -1,8 +1,8 @@
1
1
  #
2
2
  # Cookbook Name:: apt
3
- # Recipe:: proxy
3
+ # Resource:: repository
4
4
  #
5
- # Copyright 2008-2009, Opscode, Inc.
5
+ # Copyright 2010-2011, Opscode, Inc.
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
8
8
  # you may not use this file except in compliance with the License.
@@ -16,19 +16,15 @@
16
16
  # See the License for the specific language governing permissions and
17
17
  # limitations under the License.
18
18
  #
19
- package "apt-proxy" do
20
- action :install
21
- end
22
19
 
23
- service "apt-proxy" do
24
- supports :restart => true, :status => false
25
- action [ :enable, :start ]
26
- end
20
+ actions :add, :remove
27
21
 
28
- remote_file "/etc/apt-proxy/apt-proxy-v2.conf" do
29
- source "apt-proxy-v2.conf"
30
- owner "root"
31
- group "root"
32
- mode 0644
33
- notifies :restart, resources(:service => "apt-proxy")
34
- end
22
+ #name of the repo, used for source.list filename
23
+ attribute :repo_name, :kind_of => String, :name_attribute => true
24
+ attribute :uri, :kind_of => String
25
+ attribute :distribution, :kind_of => String
26
+ attribute :components, :kind_of => Array, :default => []
27
+ #whether or not to add the repository as a source repo as well
28
+ attribute :deb_src, :default => false
29
+ attribute :keyserver, :kind_of => String, :default => nil
30
+ attribute :key, :kind_of => String, :default => nil
@@ -1,3 +1,3 @@
1
1
  module Solokit
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solokit
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Joakim Kolsj\xC3\xB6"
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-25 00:00:00 +02:00
18
+ date: 2011-06-26 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -71,14 +71,16 @@ files:
71
71
  - chef/solo.rb
72
72
  - cookbooks/site/users/definitions/add_keys.rb
73
73
  - cookbooks/site/users/recipes/default.rb
74
+ - cookbooks/upstream/apt/README.md
74
75
  - cookbooks/upstream/apt/files/default/apt-cacher
75
76
  - cookbooks/upstream/apt/files/default/apt-cacher.conf
76
77
  - cookbooks/upstream/apt/files/default/apt-proxy-v2.conf
77
- - cookbooks/upstream/apt/metadata.json
78
78
  - cookbooks/upstream/apt/metadata.rb
79
+ - cookbooks/upstream/apt/providers/repository.rb
80
+ - cookbooks/upstream/apt/recipes/cacher-client.rb
79
81
  - cookbooks/upstream/apt/recipes/cacher.rb
80
82
  - cookbooks/upstream/apt/recipes/default.rb
81
- - cookbooks/upstream/apt/recipes/proxy.rb
83
+ - cookbooks/upstream/apt/resources/repository.rb
82
84
  - cookbooks/upstream/ruby-shadow/attributes/ruby-shadow.rb
83
85
  - cookbooks/upstream/ruby-shadow/files/default/shadow-1.4.1/HISTORY
84
86
  - cookbooks/upstream/ruby-shadow/files/default/shadow-1.4.1/MANIFEST
@@ -1,51 +0,0 @@
1
- {
2
- "maintainer": "Opscode, Inc.",
3
- "description": "Configures apt and apt services",
4
- "recommendations": {
5
-
6
- },
7
- "maintainer_email": "cookbooks@opscode.com",
8
- "recipes": {
9
- "apt::proxy": "Set up an APT proxy",
10
- "apt": "",
11
- "apt::cacher": "Set up an APT cache"
12
- },
13
- "suggestions": {
14
-
15
- },
16
- "platforms": {
17
- "ubuntu": [
18
-
19
- ],
20
- "debian": [
21
-
22
- ]
23
- },
24
- "version": "0.8.0",
25
- "name": "apt",
26
- "conflicting": {
27
-
28
- },
29
- "attributes": {
30
-
31
- },
32
- "providing": {
33
- "apt::proxy": [
34
-
35
- ],
36
- "apt": [
37
-
38
- ],
39
- "apt::cacher": [
40
-
41
- ]
42
- },
43
- "license": "Apache 2.0",
44
- "long_description": "",
45
- "replacing": {
46
-
47
- },
48
- "dependencies": {
49
-
50
- }
51
- }