vagabond 0.2.8 → 0.2.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. data/CHANGELOG.md +16 -0
  2. data/DEVELOP.md +38 -0
  3. data/Gemfile +3 -0
  4. data/Gemfile.lock +33 -0
  5. data/README.md +55 -21
  6. data/USAGE.md +28 -3
  7. data/Vagabondfile.sample +47 -0
  8. data/Vagrantfile +17 -5
  9. data/bin/vagabond +5 -0
  10. data/lib/vagabond/Cheffile +7 -0
  11. data/lib/vagabond/Cheffile.dev +7 -0
  12. data/lib/vagabond/actions/cluster.rb +22 -8
  13. data/lib/vagabond/actions/create.rb +7 -4
  14. data/lib/vagabond/actions/destroy.rb +24 -14
  15. data/lib/vagabond/actions/freeze.rb +1 -0
  16. data/lib/vagabond/actions/init.rb +8 -11
  17. data/lib/vagabond/actions/provision.rb +16 -8
  18. data/lib/vagabond/actions/rebuild.rb +4 -9
  19. data/lib/vagabond/actions/ssh.rb +9 -1
  20. data/lib/vagabond/actions/start.rb +1 -0
  21. data/lib/vagabond/actions/status.rb +1 -0
  22. data/lib/vagabond/actions/thaw.rb +1 -0
  23. data/lib/vagabond/actions/up.rb +22 -7
  24. data/lib/vagabond/bootstraps/chef_10_compat_config.erb +62 -0
  25. data/lib/vagabond/bootstraps/no_lazy_load.erb +63 -0
  26. data/lib/vagabond/bootstraps/server-zero.erb +1 -8
  27. data/lib/vagabond/bootstraps/server.erb +9 -6
  28. data/lib/vagabond/constants.rb +1 -6
  29. data/lib/vagabond/core.rb +209 -0
  30. data/lib/vagabond/errors.rb +3 -0
  31. data/lib/vagabond/helpers.rb +11 -99
  32. data/lib/vagabond/helpers/base.rb +134 -0
  33. data/lib/vagabond/helpers/callbacks.rb +47 -0
  34. data/lib/vagabond/helpers/chains.rb +23 -0
  35. data/lib/vagabond/helpers/commands.rb +49 -0
  36. data/lib/vagabond/helpers/knife.rb +47 -0
  37. data/lib/vagabond/helpers/naming.rb +39 -0
  38. data/lib/vagabond/helpers/server.rb +30 -0
  39. data/lib/vagabond/internal_configuration.rb +186 -32
  40. data/lib/vagabond/kitchen.rb +110 -60
  41. data/lib/vagabond/knife.rb +5 -1
  42. data/lib/vagabond/layout.rb +1 -0
  43. data/lib/vagabond/monkey/kitchen_config.rb +1 -0
  44. data/lib/vagabond/notify_mash.rb +25 -0
  45. data/lib/vagabond/server.rb +81 -49
  46. data/lib/vagabond/settings.rb +17 -0
  47. data/lib/vagabond/spec.rb +125 -99
  48. data/lib/vagabond/uploader.rb +4 -1
  49. data/lib/vagabond/uploader/berkshelf.rb +2 -1
  50. data/lib/vagabond/uploader/knife.rb +3 -9
  51. data/lib/vagabond/uploader/librarian.rb +2 -5
  52. data/lib/vagabond/vagabond.rb +77 -93
  53. data/lib/vagabond/vagabondfile.rb +73 -9
  54. data/lib/vagabond/version.rb +2 -1
  55. data/vagabond.gemspec +7 -5
  56. metadata +58 -81
  57. data/lib/vagabond/cookbooks/apt/Berksfile +0 -8
  58. data/lib/vagabond/cookbooks/apt/CHANGELOG.md +0 -97
  59. data/lib/vagabond/cookbooks/apt/CONTRIBUTING +0 -29
  60. data/lib/vagabond/cookbooks/apt/LICENSE +0 -201
  61. data/lib/vagabond/cookbooks/apt/README.md +0 -243
  62. data/lib/vagabond/cookbooks/apt/TESTING.md +0 -25
  63. data/lib/vagabond/cookbooks/apt/attributes/default.rb +0 -4
  64. data/lib/vagabond/cookbooks/apt/files/default/apt-proxy-v2.conf +0 -50
  65. data/lib/vagabond/cookbooks/apt/metadata.rb +0 -30
  66. data/lib/vagabond/cookbooks/apt/providers/preference.rb +0 -61
  67. data/lib/vagabond/cookbooks/apt/providers/repository.rb +0 -132
  68. data/lib/vagabond/cookbooks/apt/recipes/cacher-client.rb +0 -59
  69. data/lib/vagabond/cookbooks/apt/recipes/cacher-ng.rb +0 -40
  70. data/lib/vagabond/cookbooks/apt/recipes/default.rb +0 -68
  71. data/lib/vagabond/cookbooks/apt/resources/preference.rb +0 -30
  72. data/lib/vagabond/cookbooks/apt/resources/repository.rb +0 -40
  73. data/lib/vagabond/cookbooks/apt/templates/debian-6.0/acng.conf.erb +0 -174
  74. data/lib/vagabond/cookbooks/apt/templates/default/01proxy.erb +0 -2
  75. data/lib/vagabond/cookbooks/apt/templates/default/acng.conf.erb +0 -276
  76. data/lib/vagabond/cookbooks/apt/templates/ubuntu-10.04/acng.conf.erb +0 -270
  77. data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/README.md +0 -1
  78. data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/files/default/tests/minitest/cacher-ng_test.rb +0 -28
  79. data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/files/default/tests/minitest/default_test.rb +0 -28
  80. data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/files/default/tests/minitest/lwrps_test.rb +0 -48
  81. data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/files/default/tests/minitest/support/helpers.rb +0 -29
  82. data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/metadata.rb +0 -6
  83. data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/recipes/cacher-ng.rb +0 -20
  84. data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/recipes/default.rb +0 -20
  85. data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/recipes/lwrps.rb +0 -66
  86. data/lib/vagabond/cookbooks/lxc/CHANGELOG.md +0 -37
  87. data/lib/vagabond/cookbooks/lxc/Gemfile +0 -4
  88. data/lib/vagabond/cookbooks/lxc/Gemfile.lock +0 -41
  89. data/lib/vagabond/cookbooks/lxc/README.md +0 -112
  90. data/lib/vagabond/cookbooks/lxc/attributes/default.rb +0 -26
  91. data/lib/vagabond/cookbooks/lxc/files/default/knife_lxc +0 -228
  92. data/lib/vagabond/cookbooks/lxc/files/default/lxc-awesome-ephemeral +0 -499
  93. data/lib/vagabond/cookbooks/lxc/libraries/lxc.rb +0 -477
  94. data/lib/vagabond/cookbooks/lxc/libraries/lxc_expanded_resources.rb +0 -40
  95. data/lib/vagabond/cookbooks/lxc/libraries/lxc_file_config.rb +0 -84
  96. data/lib/vagabond/cookbooks/lxc/libraries/monkey.rb +0 -51
  97. data/lib/vagabond/cookbooks/lxc/metadata.rb +0 -12
  98. data/lib/vagabond/cookbooks/lxc/providers/config.rb +0 -75
  99. data/lib/vagabond/cookbooks/lxc/providers/container.rb +0 -354
  100. data/lib/vagabond/cookbooks/lxc/providers/default.rb +0 -57
  101. data/lib/vagabond/cookbooks/lxc/providers/ephemeral.rb +0 -40
  102. data/lib/vagabond/cookbooks/lxc/providers/fstab.rb +0 -30
  103. data/lib/vagabond/cookbooks/lxc/providers/interface.rb +0 -45
  104. data/lib/vagabond/cookbooks/lxc/providers/service.rb +0 -53
  105. data/lib/vagabond/cookbooks/lxc/recipes/containers.rb +0 -13
  106. data/lib/vagabond/cookbooks/lxc/recipes/default.rb +0 -58
  107. data/lib/vagabond/cookbooks/lxc/recipes/install_dependencies.rb +0 -15
  108. data/lib/vagabond/cookbooks/lxc/recipes/knife.rb +0 -37
  109. data/lib/vagabond/cookbooks/lxc/resources/config.rb +0 -19
  110. data/lib/vagabond/cookbooks/lxc/resources/container.rb +0 -54
  111. data/lib/vagabond/cookbooks/lxc/resources/default.rb +0 -12
  112. data/lib/vagabond/cookbooks/lxc/resources/ephemeral.rb +0 -13
  113. data/lib/vagabond/cookbooks/lxc/resources/fstab.rb +0 -12
  114. data/lib/vagabond/cookbooks/lxc/resources/interface.rb +0 -13
  115. data/lib/vagabond/cookbooks/lxc/resources/service.rb +0 -5
  116. data/lib/vagabond/cookbooks/lxc/templates/default/client.rb.erb +0 -13
  117. data/lib/vagabond/cookbooks/lxc/templates/default/default-lxc.erb +0 -3
  118. data/lib/vagabond/cookbooks/lxc/templates/default/file_content.erb +0 -2
  119. data/lib/vagabond/cookbooks/lxc/templates/default/fstab.erb +0 -5
  120. data/lib/vagabond/cookbooks/lxc/templates/default/interface.erb +0 -27
  121. data/lib/vagabond/cookbooks/vagabond/README.md +0 -10
  122. data/lib/vagabond/cookbooks/vagabond/attributes/default.rb +0 -18
  123. data/lib/vagabond/cookbooks/vagabond/files/default/lxc-centos +0 -460
  124. data/lib/vagabond/cookbooks/vagabond/libraries/vagabond.rb +0 -10
  125. data/lib/vagabond/cookbooks/vagabond/metadata.rb +0 -8
  126. data/lib/vagabond/cookbooks/vagabond/recipes/default.rb +0 -132
  127. data/lib/vagabond/cookbooks/vagabond/recipes/zero.rb +0 -9
  128. data/lib/vagabond/helpers/cheffile_loader.rb +0 -20
  129. data/vagabond-0.2.6.gem +0 -0
@@ -1,25 +0,0 @@
1
- This cookbook includes support for running tests via Test Kitchen (1.0). This has some requirements.
2
-
3
- 1. You must be using the Git repository, rather than the downloaded cookbook from the Chef Community Site.
4
- 2. You must have Vagrant 1.1 installed.
5
- 3. You must have a "sane" Ruby 1.9.3 environment.
6
-
7
- Once the above requirements are met, install the additional requirements:
8
-
9
- Install the berkshelf plugin for vagrant, and berkshelf to your local Ruby environment.
10
-
11
- vagrant plugin install vagrant-berkshelf
12
- gem install berkshelf
13
-
14
- Install Test Kitchen 1.0 (unreleased yet, use the alpha / prerelease version).
15
-
16
- gem install test-kitchen --pre
17
-
18
- Install the Vagrant driver for Test Kitchen.
19
-
20
- gem install kitchen-vagrant
21
-
22
- Once the above are installed, you should be able to run Test Kitchen:
23
-
24
- kitchen list
25
- kitchen test
@@ -1,4 +0,0 @@
1
- default['apt']['cacher-client']['restrict_environment'] = false
2
- default['apt']['cacher_port'] = 3142
3
- default['apt']['key_proxy'] = ''
4
- default['apt']['caching_server'] = false
@@ -1,50 +0,0 @@
1
- [DEFAULT]
2
- ;; All times are in seconds, but you can add a suffix
3
- ;; for minutes(m), hours(h) or days(d)
4
-
5
- ;; commented out address so apt-proxy will listen on all IPs
6
- ;; address = 127.0.0.1
7
- port = 9999
8
- cache_dir = /var/cache/apt-proxy
9
-
10
- ;; Control files (Packages/Sources/Contents) refresh rate
11
- min_refresh_delay = 1s
12
- complete_clientless_downloads = 1
13
-
14
- ;; Debugging settings.
15
- debug = all:4 db:0
16
-
17
- time = 30
18
- passive_ftp = on
19
-
20
- ;;--------------------------------------------------------------
21
- ;; Cache housekeeping
22
-
23
- cleanup_freq = 1d
24
- max_age = 120d
25
- max_versions = 3
26
-
27
- ;;---------------------------------------------------------------
28
- ;; Backend servers
29
- ;;
30
- ;; Place each server in its own [section]
31
-
32
- [ubuntu]
33
- ; Ubuntu archive
34
- backends =
35
- http://us.archive.ubuntu.com/ubuntu
36
-
37
- [ubuntu-security]
38
- ; Ubuntu security updates
39
- backends = http://security.ubuntu.com/ubuntu
40
-
41
- [debian]
42
- ;; Backend servers, in order of preference
43
- backends =
44
- http://debian.osuosl.org/debian/
45
-
46
- [security]
47
- ;; Debian security archive
48
- backends =
49
- http://security.debian.org/debian-security
50
- http://ftp2.de.debian.org/debian-security
@@ -1,30 +0,0 @@
1
- name "apt"
2
- maintainer "Opscode, Inc."
3
- maintainer_email "cookbooks@opscode.com"
4
- license "Apache 2.0"
5
- description "Configures apt and apt services and LWRPs for managing apt repositories and preferences"
6
- long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
7
- version "2.0.1"
8
- recipe "apt", "Runs apt-get update during compile phase and sets up preseed directories"
9
- recipe "apt::cacher-ng", "Set up an apt-cacher-ng caching proxy"
10
- recipe "apt::cacher-client", "Client for the apt::cacher-ng caching proxy"
11
-
12
- %w{ ubuntu debian }.each do |os|
13
- supports os
14
- end
15
-
16
- attribute "apt/cacher-client/restrict_environment",
17
- :description => "Whether to restrict the search for the caching server to the same environment as this node",
18
- :default => "false"
19
-
20
- attribute "apt/cacher_port",
21
- :description => "Default listen port for the caching server",
22
- :default => "3142"
23
-
24
- attribute "apt/key_proxy",
25
- :description => "Passed as the proxy passed to GPG for the apt_repository resource",
26
- :default => ""
27
-
28
- attribute "apt/caching_server",
29
- :description => "Set this to true if the node is a caching server",
30
- :default => "false"
@@ -1,61 +0,0 @@
1
- #
2
- # Cookbook Name:: apt
3
- # Provider:: preference
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
- # Build preferences.d file contents
21
- def build_pref(package_name, pin, pin_priority)
22
- preference_content = "Package: #{package_name}\nPin: #{pin}\nPin-Priority: #{pin_priority}\n"
23
- end
24
-
25
- action :add do
26
- new_resource.updated_by_last_action(false)
27
-
28
- preference = build_pref(new_resource.glob || new_resource.package_name,
29
- new_resource.pin,
30
- new_resource.pin_priority)
31
-
32
- preference_dir = directory "/etc/apt/preferences.d" do
33
- owner "root"
34
- group "root"
35
- mode 00755
36
- recursive true
37
- action :nothing
38
- end
39
-
40
- preference_file = file "/etc/apt/preferences.d/#{new_resource.name}" do
41
- owner "root"
42
- group "root"
43
- mode 00644
44
- content preference
45
- action :nothing
46
- end
47
-
48
- preference_dir.run_action(:create)
49
- # write out the preference file, replace it if it already exists
50
- preference_file.run_action(:create)
51
- end
52
-
53
- action :remove do
54
- if ::File.exists?("/etc/apt/preferences.d/#{new_resource.name}")
55
- Chef::Log.info "Un-pinning #{new_resource.name} from /etc/apt/preferences.d/"
56
- file "/etc/apt/preferences.d/#{new_resource.name}" do
57
- action :delete
58
- end
59
- new_resource.updated_by_last_action(true)
60
- end
61
- end
@@ -1,132 +0,0 @@
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
- use_inline_resources
21
-
22
- def whyrun_supported?
23
- true
24
- end
25
-
26
- # install apt key from keyserver
27
- def install_key_from_keyserver(key, keyserver)
28
- execute "install-key #{key}" do
29
- if !node['apt']['key_proxy'].empty?
30
- command "apt-key adv --keyserver-options http-proxy=#{node['apt']['key_proxy']} --keyserver #{keyserver} --recv #{key}"
31
- else
32
- command "apt-key adv --keyserver #{keyserver} --recv #{key}"
33
- end
34
- action :run
35
- not_if "apt-key list | grep #{key}"
36
- end
37
- end
38
-
39
- # run command and extract gpg ids
40
- def extract_gpg_ids_from_cmd(cmd)
41
- so = Mixlib::ShellOut.new(cmd)
42
- so.run_command
43
- so.stdout.split(/\n/).collect do |t|
44
- if z = t.match(/^pub\s+\d+\w\/([0-9A-F]{8})/)
45
- z[1]
46
- end
47
- end.compact
48
- end
49
-
50
- # install apt key from URI
51
- def install_key_from_uri(uri)
52
- key_name = uri.split(/\//).last
53
- cached_keyfile = "#{Chef::Config[:file_cache_path]}/#{key_name}"
54
- if new_resource.key =~ /http/
55
- remote_file cached_keyfile do
56
- source new_resource.key
57
- mode 00644
58
- action :create
59
- end
60
- else
61
- cookbook_file cached_keyfile do
62
- source new_resource.key
63
- cookbook new_resource.cookbook
64
- mode 00644
65
- action :create
66
- end
67
- end
68
-
69
- execute "install-key #{key_name}" do
70
- command "apt-key add #{cached_keyfile}"
71
- action :run
72
- not_if do
73
- installed_ids = extract_gpg_ids_from_cmd("apt-key finger")
74
- key_ids = extract_gpg_ids_from_cmd("gpg --with-fingerprint #{cached_keyfile}")
75
- (installed_ids & key_ids).sort == key_ids.sort
76
- end
77
- end
78
- end
79
-
80
- # build repo file contents
81
- def build_repo(uri, distribution, components, arch, add_deb_src)
82
- components = components.join(' ') if components.respond_to?(:join)
83
- repo_info = "#{uri} #{distribution} #{components}\n"
84
- repo_info = "[arch=#{arch}] #{repo_info}" if arch
85
- repo = "deb #{repo_info}"
86
- repo << "deb-src #{repo_info}" if add_deb_src
87
- repo
88
- end
89
-
90
- action :add do
91
- # add key
92
- if new_resource.keyserver && new_resource.key
93
- install_key_from_keyserver(new_resource.key, new_resource.keyserver)
94
- elsif new_resource.key
95
- install_key_from_uri(new_resource.key)
96
- end
97
-
98
- file "/var/lib/apt/periodic/update-success-stamp" do
99
- action :nothing
100
- end
101
-
102
- execute "apt-get update" do
103
- ignore_failure true
104
- action :nothing
105
- end
106
-
107
- # build repo file
108
- repository = build_repo(new_resource.uri,
109
- new_resource.distribution,
110
- new_resource.components,
111
- new_resource.arch,
112
- new_resource.deb_src)
113
-
114
- file "/etc/apt/sources.list.d/#{new_resource.name}.list" do
115
- owner "root"
116
- group "root"
117
- mode 00644
118
- content repository
119
- action :create
120
- notifies :delete, "file[/var/lib/apt/periodic/update-success-stamp]", :immediately
121
- notifies :run, "execute[apt-get update]", :immediately if new_resource.cache_rebuild
122
- end
123
- end
124
-
125
- action :remove do
126
- if ::File.exists?("/etc/apt/sources.list.d/#{new_resource.name}.list")
127
- Chef::Log.info "Removing #{new_resource.name} repository from /etc/apt/sources.list.d/"
128
- file "/etc/apt/sources.list.d/#{new_resource.name}.list" do
129
- action :delete
130
- end
131
- end
132
- end
@@ -1,59 +0,0 @@
1
- #
2
- # Cookbook Name:: apt
3
- # Recipe:: cacher-client
4
- #
5
- # Copyright 2011, 2012 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
- #remove Acquire::http::Proxy lines from /etc/apt/apt.conf since we use 01proxy
21
- #these are leftover from preseed installs
22
- execute 'Remove proxy from /etc/apt/apt.conf' do
23
- command "sed --in-place '/^Acquire::http::Proxy/d' /etc/apt/apt.conf"
24
- only_if "grep Acquire::http::Proxy /etc/apt/apt.conf"
25
- end
26
-
27
- servers = []
28
- if node['apt'] && node['apt']['cacher_ipaddress']
29
- cacher = Chef::Node.new
30
- cacher.name(node['apt']['cacher_ipaddress'])
31
- cacher.set['ipaddress'] = node['apt']['cacher_ipaddress']
32
- servers << cacher
33
- end
34
-
35
- unless Chef::Config[:solo]
36
- query = "apt_caching_server:true NOT name:#{node.name}"
37
- query += " AND chef_environment:#{node.chef_environment}" if node['apt']['cacher-client']['restrict_environment']
38
- Chef::Log.debug("apt::cacher-client searching for '#{query}'")
39
- servers += search(:node, query)
40
- end
41
-
42
- if servers.length > 0
43
- Chef::Log.info("apt-cacher-ng server found on #{servers[0]}.")
44
- template '/etc/apt/apt.conf.d/01proxy' do
45
- source '01proxy.erb'
46
- owner 'root'
47
- group 'root'
48
- mode 00644
49
- variables(
50
- :proxy => servers[0]['ipaddress'],
51
- :port => node['apt']['cacher_port']
52
- )
53
- end.run_action(:create)
54
- else
55
- Chef::Log.info('No apt-cacher-ng server found.')
56
- file '/etc/apt/apt.conf.d/01proxy' do
57
- action :delete
58
- end
59
- end
@@ -1,40 +0,0 @@
1
- #
2
- # Cookbook Name:: apt
3
- # Recipe:: cacher-ng
4
- #
5
- # Copyright 2008-2012, 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
- node.set['apt']['caching_server'] = true
21
-
22
- package "apt-cacher-ng" do
23
- action :install
24
- end
25
-
26
- template "/etc/apt-cacher-ng/acng.conf" do
27
- source "acng.conf.erb"
28
- owner "root"
29
- group "root"
30
- mode 00644
31
- notifies :restart, "service[apt-cacher-ng]"
32
- end
33
-
34
- service "apt-cacher-ng" do
35
- supports :restart => true, :status => false
36
- action [:enable, :start]
37
- end
38
-
39
- #this will help seed the proxy
40
- include_recipe "apt::cacher-client"
@@ -1,68 +0,0 @@
1
- #
2
- # Cookbook Name:: apt
3
- # Recipe:: default
4
- #
5
- # Copyright 2008-2011, Opscode, Inc.
6
- # Copyright 2009, Bryan McLellan <btm@loftninjas.org>
7
- #
8
- # Licensed under the Apache License, Version 2.0 (the "License");
9
- # you may not use this file except in compliance with the License.
10
- # You may obtain a copy of the License at
11
- #
12
- # http://www.apache.org/licenses/LICENSE-2.0
13
- #
14
- # Unless required by applicable law or agreed to in writing, software
15
- # distributed under the License is distributed on an "AS IS" BASIS,
16
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
- # See the License for the specific language governing permissions and
18
- # limitations under the License.
19
- #
20
-
21
- # Run apt-get update to create the stamp file
22
- execute "apt-get-update" do
23
- command "apt-get update"
24
- ignore_failure true
25
- not_if do ::File.exists?('/var/lib/apt/periodic/update-success-stamp') end
26
- end
27
-
28
- # For other recipes to call to force an update
29
- execute "apt-get update" do
30
- command "apt-get update"
31
- ignore_failure true
32
- action :nothing
33
- end
34
-
35
- # Automatically remove packages that are no longer needed for dependencies
36
- execute "apt-get autoremove" do
37
- command "apt-get -y autoremove"
38
- action :nothing
39
- end
40
-
41
- # Automatically remove .deb files for packages no longer on your system
42
- execute "apt-get autoclean" do
43
- command "apt-get -y autoclean"
44
- action :nothing
45
- end
46
-
47
- # provides /var/lib/apt/periodic/update-success-stamp on apt-get update
48
- package "update-notifier-common" do
49
- notifies :run, 'execute[apt-get-update]', :immediately
50
- end
51
-
52
- execute "apt-get-update-periodic" do
53
- command "apt-get update"
54
- ignore_failure true
55
- only_if do
56
- ::File.exists?('/var/lib/apt/periodic/update-success-stamp') &&
57
- ::File.mtime('/var/lib/apt/periodic/update-success-stamp') < Time.now - 86400
58
- end
59
- end
60
-
61
- %w{/var/cache/local /var/cache/local/preseeding}.each do |dirname|
62
- directory dirname do
63
- owner "root"
64
- group "root"
65
- mode 00755
66
- action :create
67
- end
68
- end