Use chef-solo to install phantomjs into Vagrant VM.
This introduces two configuration management runs into the Vagrant provisioning phase. The first chef-solo run ensures that a current version of chef is installed using the omnibus updater. The second chef-solo run installs vim and phantomjs. Much more is possible, this is a proof of concept. Cookbooks are stored in the chef directory, and managed by librarian-chef, which is like a bundler for cookbooks. Chef is run when VM is first downloaded and booted, but not on subsequent halt/up cycles. To force chef to run again, use `vagrant provision`.
This commit is contained in:
parent
9e198c3ac5
commit
f3bcbd8bc3
|
@ -59,3 +59,6 @@ config/fog_credentials.yml
|
|||
# Scripts used for downloading/refshing db
|
||||
script/download_db
|
||||
script/refresh_db
|
||||
|
||||
# temp directory for chef (used to configure vagrant VM)
|
||||
chef/tmp/*
|
||||
|
|
|
@ -49,7 +49,7 @@ Once your VM is up to date, you can start a rails instance using the following c
|
|||
bundle exec rails server
|
||||
```
|
||||
|
||||
In a few seconds, rails will start server pages. To access them, open a web browser to http://localhost:4000 - if it all worked you should see discourse! Congratulations, you are ready to start working!
|
||||
In a few seconds, rails will start serving pages. To access them, open a web browser to http://localhost:4000 - if it all worked you should see discourse! Congratulations, you are ready to start working!
|
||||
|
||||
You can now edit files on your local file system, using your favorite text editor or IDE. When you reload your web browser, it should have the latest changed.
|
||||
|
||||
|
|
1
Gemfile
1
Gemfile
|
@ -106,6 +106,7 @@ group :development do
|
|||
gem 'pry-rails'
|
||||
gem 'better_errors'
|
||||
gem 'binding_of_caller' # I tried adding this and got an occational crash
|
||||
gem 'librarian', '>= 0.0.25', :require => false
|
||||
end
|
||||
|
||||
# gem 'stacktrace', :require => false
|
||||
|
|
50
Gemfile.lock
50
Gemfile.lock
|
@ -97,6 +97,7 @@ GEM
|
|||
airbrake (3.1.2)
|
||||
activesupport
|
||||
builder
|
||||
archive-tar-minitar (0.5.2)
|
||||
arel (3.0.2)
|
||||
barber (0.2.0)
|
||||
execjs
|
||||
|
@ -111,6 +112,20 @@ GEM
|
|||
facter (>= 1.6.12)
|
||||
timers (>= 1.0.0)
|
||||
certified (0.1.1)
|
||||
chef (11.2.0)
|
||||
erubis
|
||||
highline (>= 1.6.9)
|
||||
json (~> 1.7.6, >= 1.4.4)
|
||||
mixlib-authentication (>= 1.3.0)
|
||||
mixlib-cli (~> 1.3.0)
|
||||
mixlib-config (>= 1.1.2)
|
||||
mixlib-log (>= 1.3.0)
|
||||
mixlib-shellout
|
||||
net-ssh (~> 2.6)
|
||||
net-ssh-multi (~> 1.1.0)
|
||||
ohai (>= 0.6.0)
|
||||
rest-client (>= 1.0.4, < 1.7.0)
|
||||
yajl-ruby (~> 1.1)
|
||||
childprocess (0.3.7)
|
||||
ffi (~> 1.0, >= 1.0.6)
|
||||
clockwork (0.4.1)
|
||||
|
@ -172,6 +187,7 @@ GEM
|
|||
spork (>= 0.8.4)
|
||||
haml (3.1.7)
|
||||
has_ip_address (0.0.1)
|
||||
highline (1.6.15)
|
||||
hike (1.2.1)
|
||||
hiredis (0.4.5)
|
||||
hpricot (0.8.6)
|
||||
|
@ -185,6 +201,7 @@ GEM
|
|||
progress (~> 2.4.0)
|
||||
image_size (1.1.1)
|
||||
in_threads (1.1.1)
|
||||
ipaddress (0.8.0)
|
||||
jasminerice (0.0.10)
|
||||
coffee-rails
|
||||
haml
|
||||
|
@ -197,6 +214,11 @@ GEM
|
|||
addressable (~> 2.2)
|
||||
faraday (~> 0.8)
|
||||
multi_json (~> 1.3)
|
||||
librarian (0.0.26)
|
||||
archive-tar-minitar (>= 0.5.2)
|
||||
chef (>= 0.10)
|
||||
highline
|
||||
thor (~> 0.15)
|
||||
libv8 (3.11.8.13)
|
||||
listen (0.7.2)
|
||||
lumberjack (1.0.2)
|
||||
|
@ -207,6 +229,12 @@ GEM
|
|||
metaclass (0.0.1)
|
||||
method_source (0.8.1)
|
||||
mime-types (1.20.1)
|
||||
mixlib-authentication (1.3.0)
|
||||
mixlib-log
|
||||
mixlib-cli (1.3.0)
|
||||
mixlib-config (1.1.2)
|
||||
mixlib-log (1.4.1)
|
||||
mixlib-shellout (1.1.0)
|
||||
mocha (0.10.5)
|
||||
metaclass (~> 0.0.1)
|
||||
multi_json (1.5.0)
|
||||
|
@ -215,8 +243,21 @@ GEM
|
|||
net-scp (1.0.4)
|
||||
net-ssh (>= 1.99.1)
|
||||
net-ssh (2.6.3)
|
||||
net-ssh-gateway (1.1.0)
|
||||
net-ssh (>= 1.99.1)
|
||||
net-ssh-multi (1.1)
|
||||
net-ssh (>= 2.1.4)
|
||||
net-ssh-gateway (>= 0.99.0)
|
||||
nokogiri (1.5.6)
|
||||
oauth (0.4.7)
|
||||
ohai (6.16.0)
|
||||
ipaddress
|
||||
mixlib-cli
|
||||
mixlib-config
|
||||
mixlib-log
|
||||
mixlib-shellout
|
||||
systemu
|
||||
yajl-ruby
|
||||
oj (2.0.3)
|
||||
pbkdf2 (0.1.0)
|
||||
pg (0.14.1)
|
||||
|
@ -331,8 +372,8 @@ GEM
|
|||
rack (~> 1.4)
|
||||
rack-protection (~> 1.3)
|
||||
tilt (~> 1.3, >= 1.3.3)
|
||||
slim (1.3.0)
|
||||
temple (~> 0.4.1)
|
||||
slim (1.3.6)
|
||||
temple (~> 0.5.5)
|
||||
tilt (~> 1.3.3)
|
||||
slop (3.4.3)
|
||||
spork (0.9.2)
|
||||
|
@ -341,7 +382,8 @@ GEM
|
|||
multi_json (~> 1.0)
|
||||
rack (~> 1.0)
|
||||
tilt (~> 1.1, != 1.3.0)
|
||||
temple (0.4.1)
|
||||
systemu (2.5.2)
|
||||
temple (0.5.5)
|
||||
terminal-notifier-guard (1.5.3)
|
||||
terminal-table (1.4.5)
|
||||
therubyracer (0.11.3)
|
||||
|
@ -364,6 +406,7 @@ GEM
|
|||
uglifier (1.3.0)
|
||||
execjs (>= 0.3.0)
|
||||
multi_json (~> 1.0, >= 1.0.2)
|
||||
yajl-ruby (1.1.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
@ -398,6 +441,7 @@ DEPENDENCIES
|
|||
jasminerice
|
||||
jquery-rails
|
||||
koala
|
||||
librarian (>= 0.0.25)
|
||||
message_bus!
|
||||
mocha
|
||||
multi_json
|
||||
|
|
|
@ -26,4 +26,26 @@ Vagrant::Config.run do |config|
|
|||
config.vm.forward_port 1080, 4080 # Mailcatcher
|
||||
|
||||
config.vm.share_folder("v-root", "/vagrant", ".")
|
||||
|
||||
chef_cookbooks_path = ["chef/cookbooks"]
|
||||
|
||||
# The first chef run just upgrades the chef installation using omnibus
|
||||
config.vm.provision :chef_solo do |chef|
|
||||
chef.binary_env = "GEM_HOME=/opt/vagrant_ruby/lib/ruby/gems/1.8/ GEM_PATH= "
|
||||
chef.binary_path = "/opt/vagrant_ruby/bin/"
|
||||
chef.cookbooks_path = chef_cookbooks_path
|
||||
chef.add_recipe "recipe[omnibus_updater]"
|
||||
chef.json = { :omnibus_updater => { 'version_search' => false }}
|
||||
end
|
||||
|
||||
# The second chef run uses the updated chef-solo and does normal configuration
|
||||
config.vm.provision :chef_solo do |chef|
|
||||
chef.binary_env = "GEM_HOME=/opt/chef/embedded/lib/ruby/gems/1.9.1/ GEM_PATH= "
|
||||
chef.binary_path = "/opt/chef/bin/"
|
||||
chef.cookbooks_path = chef_cookbooks_path
|
||||
chef.add_recipe "recipe[apt]"
|
||||
chef.add_recipe "recipe[build-essential]"
|
||||
chef.add_recipe "recipe[phantomjs]"
|
||||
chef.add_recipe "recipe[vim]"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
LIBRARIAN_CHEF_INSTALL__STRIP_DOT_GIT: '1'
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/env ruby
|
||||
#^syntax detection
|
||||
|
||||
site 'http://community.opscode.com/api/v1'
|
||||
|
||||
cookbook 'apt'
|
||||
cookbook 'vim'
|
||||
cookbook 'phantomjs'
|
||||
cookbook 'build-essential'
|
||||
cookbook 'omnibus_updater'
|
|
@ -0,0 +1,16 @@
|
|||
SITE
|
||||
remote: http://community.opscode.com/api/v1
|
||||
specs:
|
||||
apt (1.8.4)
|
||||
build-essential (1.3.4)
|
||||
omnibus_updater (0.1.2)
|
||||
phantomjs (0.0.10)
|
||||
vim (1.0.2)
|
||||
|
||||
DEPENDENCIES
|
||||
apt (>= 0)
|
||||
build-essential (>= 0)
|
||||
omnibus_updater (>= 0)
|
||||
phantomjs (>= 0)
|
||||
vim (>= 0)
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
.bundle
|
||||
.cache
|
||||
.kitchen
|
||||
bin
|
|
@ -0,0 +1,70 @@
|
|||
## v1.8.4:
|
||||
|
||||
* [COOK-2171] - Update README to clarify required Chef version: 10.18.0
|
||||
or higher.
|
||||
|
||||
## v1.8.2:
|
||||
|
||||
* [COOK-2112] - need [] around "arch" in sources.list entries
|
||||
* [COOK-2171] - fixes a regression in the notification
|
||||
|
||||
## v1.8.0:
|
||||
|
||||
* [COOK-2143] - Allow for a custom cacher-ng port
|
||||
* [COOK-2171] - On `apt_repository.run_action(:add)` the source file
|
||||
is not created.
|
||||
* [COOK-2184] - apt::cacher-ng, use `cacher_port` attribute in
|
||||
acng.conf
|
||||
|
||||
## v1.7.0:
|
||||
|
||||
* [COOK-2082] - add "arch" parameter to apt_repository LWRP
|
||||
|
||||
## v1.6.0:
|
||||
|
||||
* [COOK-1893] - `apt_preference` use "`package_name`" resource instead of "name"
|
||||
* [COOK-1894] - change filename for sources.list.d files
|
||||
* [COOK-1914] - Wrong dir permissions for /etc/apt/preferences.d/
|
||||
* [COOK-1942] - README.md has wrong name for the keyserver attribute
|
||||
* [COOK-2019] - create 01proxy before any other apt-get updates get executed
|
||||
|
||||
## v1.5.2:
|
||||
|
||||
* [COOK-1682] - use template instead of file resource in apt::cacher-client
|
||||
* [COOK-1875] - cacher-client should be Environment-aware
|
||||
|
||||
## V1.5.0:
|
||||
|
||||
* [COOK-1500] - Avoid triggering apt-get update
|
||||
* [COOK-1548] - Add execute commands for autoclean and autoremove
|
||||
* [COOK-1591] - Setting up the apt proxy should leave https
|
||||
connections direct
|
||||
* [COOK-1596] - execute[apt-get-update-periodic] never runs
|
||||
* [COOK-1762] - create /etc/apt/preferences.d directory
|
||||
* [COOK-1776] - apt key check isn't idempotent
|
||||
|
||||
## v1.4.8:
|
||||
|
||||
* Adds test-kitchen support
|
||||
* [COOK-1435] - repository lwrp is not idempotent with http key
|
||||
|
||||
## v1.4.6:
|
||||
|
||||
* [COOK-1530] - apt_repository isn't aware of update-success-stamp
|
||||
file (also reverts COOK-1382 patch).
|
||||
|
||||
## v1.4.4:
|
||||
|
||||
* [COOK-1229] - Allow cacher IP to be set manually in non-Chef Solo
|
||||
environments
|
||||
* [COOK-1530] - Immediately update apt-cache when sources.list file is dropped off
|
||||
|
||||
## v1.4.2:
|
||||
|
||||
* [COOK-1155] - LWRP for apt pinning
|
||||
|
||||
## v1.4.0:
|
||||
|
||||
* [COOK-889] - overwrite existing repo source files
|
||||
* [COOK-921] - optionally use cookbook\_file or remote\_file for key
|
||||
* [COOK-1032] - fixes problem with apt repository key installation
|
|
@ -0,0 +1,29 @@
|
|||
If you would like to contribute, please open a ticket in JIRA:
|
||||
|
||||
* http://tickets.opscode.com
|
||||
|
||||
Create the ticket in the COOK project and use the cookbook name as the
|
||||
component.
|
||||
|
||||
For all code contributions, we ask that contributors sign a
|
||||
contributor license agreement (CLA). Instructions may be found here:
|
||||
|
||||
* http://wiki.opscode.com/display/chef/How+to+Contribute
|
||||
|
||||
When contributing changes to individual cookbooks, please do not
|
||||
modify the version number in the metadata.rb. Also please do not
|
||||
update the CHANGELOG.md for a new version. Not all changes to a
|
||||
cookbook may be merged and released in the same versions. Opscode will
|
||||
handle the version updates during the release process. You are welcome
|
||||
to correct typos or otherwise make updates to documentation in the
|
||||
README.
|
||||
|
||||
If a contribution adds new platforms or platform versions, indicate
|
||||
such in the body of the commit message(s), and update the relevant
|
||||
COOK ticket. When writing commit messages, it is helpful for others if
|
||||
you indicate the COOK ticket. For example:
|
||||
|
||||
git commit -m '[COOK-1041] Updated pool resource to correctly delete.'
|
||||
|
||||
In the ticket itself, it is also helpful if you include log output of
|
||||
a successful Chef run, but this is not absolutely required.
|
|
@ -0,0 +1,3 @@
|
|||
source :rubygems
|
||||
|
||||
gem 'test-kitchen', '>= 0.7.0'
|
|
@ -0,0 +1,132 @@
|
|||
GEM
|
||||
remote: http://rubygems.org/
|
||||
specs:
|
||||
archive-tar-minitar (0.5.2)
|
||||
builder (3.1.4)
|
||||
bunny (0.7.9)
|
||||
chef (10.18.2)
|
||||
bunny (>= 0.6.0, < 0.8.0)
|
||||
erubis
|
||||
highline (>= 1.6.9)
|
||||
json (>= 1.4.4, <= 1.6.1)
|
||||
mixlib-authentication (>= 1.3.0)
|
||||
mixlib-cli (>= 1.1.0)
|
||||
mixlib-config (>= 1.1.2)
|
||||
mixlib-log (>= 1.3.0)
|
||||
mixlib-shellout
|
||||
moneta (< 0.7.0)
|
||||
net-ssh (~> 2.2.2)
|
||||
net-ssh-multi (~> 1.1.0)
|
||||
ohai (>= 0.6.0)
|
||||
rest-client (>= 1.0.4, < 1.7.0)
|
||||
treetop (~> 1.4.9)
|
||||
uuidtools
|
||||
yajl-ruby (~> 1.1)
|
||||
childprocess (0.3.7)
|
||||
ffi (~> 1.0, >= 1.0.6)
|
||||
coderay (1.0.8)
|
||||
erubis (2.7.0)
|
||||
excon (0.16.10)
|
||||
ffi (1.3.1)
|
||||
fog (1.9.0)
|
||||
builder
|
||||
excon (~> 0.14)
|
||||
formatador (~> 0.2.0)
|
||||
mime-types
|
||||
multi_json (~> 1.0)
|
||||
net-scp (~> 1.0.4)
|
||||
net-ssh (>= 2.1.3)
|
||||
nokogiri (~> 1.5.0)
|
||||
ruby-hmac
|
||||
foodcritic (1.7.0)
|
||||
erubis
|
||||
gherkin (~> 2.11.1)
|
||||
gist (~> 3.1.0)
|
||||
nokogiri (~> 1.5.4)
|
||||
pry (~> 0.9.8.4)
|
||||
rak (~> 1.4)
|
||||
treetop (~> 1.4.10)
|
||||
yajl-ruby (~> 1.1.0)
|
||||
formatador (0.2.4)
|
||||
gherkin (2.11.5)
|
||||
json (>= 1.4.6)
|
||||
gist (3.1.1)
|
||||
hashr (0.0.22)
|
||||
highline (1.6.15)
|
||||
i18n (0.6.1)
|
||||
ipaddress (0.8.0)
|
||||
json (1.5.4)
|
||||
librarian (0.0.26)
|
||||
archive-tar-minitar (>= 0.5.2)
|
||||
chef (>= 0.10)
|
||||
highline
|
||||
thor (~> 0.15)
|
||||
log4r (1.1.10)
|
||||
method_source (0.7.1)
|
||||
mime-types (1.19)
|
||||
mixlib-authentication (1.3.0)
|
||||
mixlib-log
|
||||
mixlib-cli (1.2.2)
|
||||
mixlib-config (1.1.2)
|
||||
mixlib-log (1.4.1)
|
||||
mixlib-shellout (1.1.0)
|
||||
moneta (0.6.0)
|
||||
multi_json (1.5.0)
|
||||
net-scp (1.0.4)
|
||||
net-ssh (>= 1.99.1)
|
||||
net-ssh (2.2.2)
|
||||
net-ssh-gateway (1.1.0)
|
||||
net-ssh (>= 1.99.1)
|
||||
net-ssh-multi (1.1)
|
||||
net-ssh (>= 2.1.4)
|
||||
net-ssh-gateway (>= 0.99.0)
|
||||
nokogiri (1.5.6)
|
||||
ohai (6.16.0)
|
||||
ipaddress
|
||||
mixlib-cli
|
||||
mixlib-config
|
||||
mixlib-log
|
||||
mixlib-shellout
|
||||
systemu
|
||||
yajl-ruby
|
||||
polyglot (0.3.3)
|
||||
pry (0.9.8.4)
|
||||
coderay (~> 1.0.5)
|
||||
method_source (~> 0.7.1)
|
||||
slop (>= 2.4.4, < 3)
|
||||
rak (1.4)
|
||||
rest-client (1.6.7)
|
||||
mime-types (>= 1.16)
|
||||
ruby-hmac (0.4.0)
|
||||
slop (2.4.4)
|
||||
systemu (2.5.2)
|
||||
test-kitchen (0.7.0)
|
||||
fog
|
||||
foodcritic (>= 1.4.0)
|
||||
hashr (~> 0.0.20)
|
||||
highline (>= 1.6.9)
|
||||
librarian (~> 0.0.20)
|
||||
mixlib-cli (~> 1.2.2)
|
||||
vagrant (~> 1.0.2)
|
||||
yajl-ruby (~> 1.1.0)
|
||||
thor (0.16.0)
|
||||
treetop (1.4.12)
|
||||
polyglot
|
||||
polyglot (>= 0.3.1)
|
||||
uuidtools (2.1.3)
|
||||
vagrant (1.0.6)
|
||||
archive-tar-minitar (= 0.5.2)
|
||||
childprocess (~> 0.3.1)
|
||||
erubis (~> 2.7.0)
|
||||
i18n (~> 0.6.0)
|
||||
json (~> 1.5.1)
|
||||
log4r (~> 1.1.9)
|
||||
net-scp (~> 1.0.4)
|
||||
net-ssh (~> 2.2.2)
|
||||
yajl-ruby (1.1.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
test-kitchen (>= 0.7.0)
|
|
@ -0,0 +1,201 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
|
@ -0,0 +1,229 @@
|
|||
Description
|
||||
===========
|
||||
|
||||
This cookbook includes recipes to execute apt-get update to ensure the
|
||||
local APT package cache is up to date. There are recipes for managing
|
||||
the apt-cacher-ng caching proxy and proxy clients. It also includes a
|
||||
LWRP for managing APT repositories in /etc/apt/sources.list.d as well as
|
||||
an LWRP for pinning packages via /etc/apt/preferences.d.
|
||||
|
||||
Requirements
|
||||
============
|
||||
|
||||
Version 1.8.2+ of this cookbook requires **Chef 10.16.4** or later.
|
||||
|
||||
If your Chef version is earlier than 10.16.4, use version 1.7.0 of
|
||||
this cookbook.
|
||||
|
||||
See [CHEF-3493](http://tickets.opscode.com/browse/CHEF-3493) and
|
||||
[this code comment](http://bit.ly/VgvCgf) for more information on this
|
||||
requirement.
|
||||
|
||||
Platform
|
||||
--------
|
||||
|
||||
* Debian
|
||||
* Ubuntu
|
||||
|
||||
May work with or without modification on other Debian derivatives.
|
||||
|
||||
Recipes
|
||||
=======
|
||||
|
||||
default
|
||||
-------
|
||||
|
||||
This recipe installs the `update-notifier-common` package to provide
|
||||
the timestamp file used to only run `apt-get update` if the cache is
|
||||
more than one day old.
|
||||
|
||||
This recipe should appear first in the run list of Debian or Ubuntu
|
||||
nodes to ensure that the package cache is up to date before managing
|
||||
any `package` resources with Chef.
|
||||
|
||||
This recipe also sets up a local cache directory for preseeding packages.
|
||||
|
||||
cacher-ng
|
||||
---------
|
||||
|
||||
Installs the `apt-cacher-ng` package and service so the system can
|
||||
provide APT caching. You can check the usage report at
|
||||
http://{hostname}:3142/acng-report.html. The `cacher-ng` recipe
|
||||
includes the `cacher-client` recipe, so it helps seed itself.
|
||||
|
||||
cacher-client
|
||||
-------------
|
||||
Configures the node to use the `apt-cacher-ng` server as a client. If you
|
||||
want to restrict your node to using the `apt-cacher-ng` server in your
|
||||
Environment, set `['apt']['cacher-client']['restrict_environment']` to `true`.
|
||||
To use a cacher server (or standard proxy server) not available via search
|
||||
set the atttribute `['apt']['cacher-ipaddress']` and for a custom port
|
||||
set `['apt']['cacher_port']`
|
||||
|
||||
Resources/Providers
|
||||
===================
|
||||
|
||||
Managing repositories
|
||||
---------------------
|
||||
|
||||
This LWRP provides an easy way to manage additional APT repositories.
|
||||
Adding a new repository will notify running the `execute[apt-get-update]`
|
||||
resource immediately.
|
||||
|
||||
# Actions
|
||||
|
||||
- :add: creates a repository file and builds the repository listing
|
||||
- :remove: removes the repository file
|
||||
|
||||
# Attribute Parameters
|
||||
|
||||
- repo_name: name attribute. The name of the channel to discover
|
||||
- uri: the base of the Debian distribution
|
||||
- distribution: this is usually your release's codename...ie something
|
||||
like `karmic`, `lucid` or `maverick`
|
||||
- components: package groupings..when it doubt use `main`
|
||||
- arch: constrain package to a particular arch like `i386`, `amd64` or
|
||||
even `armhf` or `powerpc`. Defaults to nil.
|
||||
- deb_src: whether or not to add the repository as a source repo as
|
||||
well - value can be `true` or `false`, default `false`.
|
||||
- keyserver: the GPG keyserver where the key for the repo should be retrieved
|
||||
- key: if a `keyserver` is provided, this is assumed to be the
|
||||
fingerprint, otherwise it can be either the URI to the GPG key for
|
||||
the repo, or a cookbook_file.
|
||||
- cookbook: if key should be a cookbook_file, specify a cookbook where
|
||||
the key is located for files/default. Defaults to nil, so it will
|
||||
use the cookbook where the resource is used.
|
||||
|
||||
# Examples
|
||||
|
||||
# add the Zenoss repo
|
||||
apt_repository "zenoss" do
|
||||
uri "http://dev.zenoss.org/deb"
|
||||
components ["main","stable"]
|
||||
end
|
||||
|
||||
# add the Nginx PPA; grab key from keyserver
|
||||
apt_repository "nginx-php" do
|
||||
uri "http://ppa.launchpad.net/nginx/php5/ubuntu"
|
||||
distribution node['lsb']['codename']
|
||||
components ["main"]
|
||||
keyserver "keyserver.ubuntu.com"
|
||||
key "C300EE8C"
|
||||
end
|
||||
|
||||
# add the Nginx PPA; grab key from keyserver, also add source repo
|
||||
apt_repository "nginx-php" do
|
||||
uri "http://ppa.launchpad.net/nginx/php5/ubuntu"
|
||||
distribution node['lsb']['codename']
|
||||
components ["main"]
|
||||
keyserver "keyserver.ubuntu.com"
|
||||
key "C300EE8C"
|
||||
deb_src true
|
||||
end
|
||||
|
||||
# add the Cloudkick Repo
|
||||
apt_repository "cloudkick" do
|
||||
uri "http://packages.cloudkick.com/ubuntu"
|
||||
distribution node['lsb']['codename']
|
||||
components ["main"]
|
||||
key "http://packages.cloudkick.com/cloudkick.packages.key"
|
||||
end
|
||||
|
||||
# add the Cloudkick Repo with the key downloaded in the cookbook
|
||||
apt_repository "cloudkick" do
|
||||
uri "http://packages.cloudkick.com/ubuntu"
|
||||
distribution node['lsb']['codename']
|
||||
components ["main"]
|
||||
key "cloudkick.packages.key"
|
||||
end
|
||||
|
||||
# add the Cloudera Repo of CDH4 packages for Ubuntu 12.04 on AMD64
|
||||
apt_repository "cloudera" do
|
||||
uri "http://archive.cloudera.com/cdh4/ubuntu/precise/amd64/cdh"
|
||||
arch "amd64"
|
||||
distribution "precise-cdh4"
|
||||
components ["contrib"]
|
||||
key "http://archive.cloudera.com/debian/archive.key"
|
||||
end
|
||||
|
||||
# remove Zenoss repo
|
||||
apt_repository "zenoss" do
|
||||
action :remove
|
||||
end
|
||||
|
||||
Pinning packages
|
||||
----------------
|
||||
|
||||
This LWRP provides an easy way to pin packages in /etc/apt/preferences.d.
|
||||
Although apt-pinning is quite helpful from time to time please note that Debian
|
||||
does not encourage its use without thorough consideration.
|
||||
|
||||
Further information regarding apt-pinning is available via
|
||||
http://wiki.debian.org/AptPreferences.
|
||||
|
||||
# Actions
|
||||
|
||||
- :add: creates a preferences file under /etc/apt/preferences.d
|
||||
- :remove: Removes the file, therefore unpin the package
|
||||
|
||||
# Attribute Parameters
|
||||
|
||||
- package_name: name attribute. The name of the package
|
||||
- pin: The package version/repository to pin
|
||||
- pin_priority: The pinning priority aka "the highest package version wins"
|
||||
|
||||
# Examples
|
||||
|
||||
# Pin libmysqlclient16 to version 5.1.49-3
|
||||
apt_preference "libmysqlclient16" do
|
||||
pin "version 5.1.49-3"
|
||||
pin_priority "700"
|
||||
end
|
||||
|
||||
# Unpin libmysqlclient16
|
||||
apt_preference "libmysqlclient16" do
|
||||
action :remove
|
||||
end
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
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.:
|
||||
|
||||
template "/etc/apt/sources.list.d/my_apt_sources.list" do
|
||||
notifies :run, resources(:execute => "apt-get update"), :immediately
|
||||
end
|
||||
|
||||
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.
|
||||
|
||||
Put `recipe[apt::cacher-ng]` 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.
|
||||
|
||||
If you want to cleanup unused packages, there is also the `apt-get autoclean`
|
||||
and `apt-get autoremove` resources provided for automated cleanup.
|
||||
|
||||
License and Author
|
||||
==================
|
||||
|
||||
Author:: Joshua Timberman (<joshua@opscode.com>)
|
||||
Author:: Matt Ray (<matt@opscode.com>)
|
||||
Author:: Seth Chisamore (<schisamo@opscode.com>)
|
||||
|
||||
Copyright 2009-2012 Opscode, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
|
@ -0,0 +1,2 @@
|
|||
default['apt']['cacher-client']['restrict_environment'] = false
|
||||
default['apt']['cacher_port'] = 3142
|
|
@ -0,0 +1,50 @@
|
|||
[DEFAULT]
|
||||
;; All times are in seconds, but you can add a suffix
|
||||
;; for minutes(m), hours(h) or days(d)
|
||||
|
||||
;; commented out address so apt-proxy will listen on all IPs
|
||||
;; address = 127.0.0.1
|
||||
port = 9999
|
||||
cache_dir = /var/cache/apt-proxy
|
||||
|
||||
;; Control files (Packages/Sources/Contents) refresh rate
|
||||
min_refresh_delay = 1s
|
||||
complete_clientless_downloads = 1
|
||||
|
||||
;; Debugging settings.
|
||||
debug = all:4 db:0
|
||||
|
||||
time = 30
|
||||
passive_ftp = on
|
||||
|
||||
;;--------------------------------------------------------------
|
||||
;; Cache housekeeping
|
||||
|
||||
cleanup_freq = 1d
|
||||
max_age = 120d
|
||||
max_versions = 3
|
||||
|
||||
;;---------------------------------------------------------------
|
||||
;; Backend servers
|
||||
;;
|
||||
;; Place each server in its own [section]
|
||||
|
||||
[ubuntu]
|
||||
; Ubuntu archive
|
||||
backends =
|
||||
http://us.archive.ubuntu.com/ubuntu
|
||||
|
||||
[ubuntu-security]
|
||||
; Ubuntu security updates
|
||||
backends = http://security.ubuntu.com/ubuntu
|
||||
|
||||
[debian]
|
||||
;; Backend servers, in order of preference
|
||||
backends =
|
||||
http://debian.osuosl.org/debian/
|
||||
|
||||
[security]
|
||||
;; Debian security archive
|
||||
backends =
|
||||
http://security.debian.org/debian-security
|
||||
http://ftp2.de.debian.org/debian-security
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,14 @@
|
|||
name "apt"
|
||||
maintainer "Opscode, Inc."
|
||||
maintainer_email "cookbooks@opscode.com"
|
||||
license "Apache 2.0"
|
||||
description "Configures apt and apt services and LWRPs for managing apt repositories and preferences"
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version "1.8.4"
|
||||
recipe "apt", "Runs apt-get update during compile phase and sets up preseed directories"
|
||||
recipe "apt::cacher-ng", "Set up an apt-cacher-ng caching proxy"
|
||||
recipe "apt::cacher-client", "Client for the apt::cacher-ng caching proxy"
|
||||
|
||||
%w{ ubuntu debian }.each do |os|
|
||||
supports os
|
||||
end
|
|
@ -0,0 +1,61 @@
|
|||
#
|
||||
# Cookbook Name:: apt
|
||||
# Provider:: preference
|
||||
#
|
||||
# Copyright 2010-2011, Opscode, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
# Build preferences.d file contents
|
||||
def build_pref(package_name, pin, pin_priority)
|
||||
preference_content = "Package: #{package_name}\nPin: #{pin}\nPin-Priority: #{pin_priority}\n"
|
||||
end
|
||||
|
||||
action :add do
|
||||
new_resource.updated_by_last_action(false)
|
||||
|
||||
preference = build_pref(new_resource.package_name,
|
||||
new_resource.pin,
|
||||
new_resource.pin_priority)
|
||||
|
||||
preference_dir = directory "/etc/apt/preferences.d" do
|
||||
owner "root"
|
||||
group "root"
|
||||
mode 00755
|
||||
recursive true
|
||||
action :nothing
|
||||
end
|
||||
|
||||
preference_file = file "/etc/apt/preferences.d/#{new_resource.name}" do
|
||||
owner "root"
|
||||
group "root"
|
||||
mode 00644
|
||||
content preference
|
||||
action :nothing
|
||||
end
|
||||
|
||||
preference_dir.run_action(:create)
|
||||
# write out the preference file, replace it if it already exists
|
||||
preference_file.run_action(:create)
|
||||
end
|
||||
|
||||
action :remove do
|
||||
if ::File.exists?("/etc/apt/preferences.d/#{new_resource.name}")
|
||||
Chef::Log.info "Un-pinning #{new_resource.name} from /etc/apt/preferences.d/"
|
||||
file "/etc/apt/preferences.d/#{new_resource.name}" do
|
||||
action :delete
|
||||
end
|
||||
new_resource.updated_by_last_action(true)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,134 @@
|
|||
#
|
||||
# Cookbook Name:: apt
|
||||
# Provider:: repository
|
||||
#
|
||||
# Copyright 2010-2011, Opscode, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
def whyrun_supported?
|
||||
true
|
||||
end
|
||||
|
||||
# install apt key from keyserver
|
||||
def install_key_from_keyserver(key, keyserver)
|
||||
execute "install-key #{key}" do
|
||||
command "apt-key adv --keyserver #{keyserver} --recv #{key}"
|
||||
action :run
|
||||
not_if "apt-key list | grep #{key}"
|
||||
end
|
||||
end
|
||||
|
||||
# run command and extract gpg ids
|
||||
def extract_gpg_ids_from_cmd(cmd)
|
||||
so = Mixlib::ShellOut.new(cmd)
|
||||
so.run_command
|
||||
so.stdout.split(/\n/).collect do |t|
|
||||
if z = t.match(/^pub\s+\d+\w\/([0-9A-F]{8})/)
|
||||
z[1]
|
||||
end
|
||||
end.compact
|
||||
end
|
||||
|
||||
# install apt key from URI
|
||||
def install_key_from_uri(uri)
|
||||
key_name = uri.split(/\//).last
|
||||
cached_keyfile = "#{Chef::Config[:file_cache_path]}/#{key_name}"
|
||||
if new_resource.key =~ /http/
|
||||
remote_file cached_keyfile do
|
||||
source new_resource.key
|
||||
mode 00644
|
||||
action :create
|
||||
end
|
||||
else
|
||||
cookbook_file cached_keyfile do
|
||||
source new_resource.key
|
||||
cookbook new_resource.cookbook
|
||||
mode 00644
|
||||
action :create
|
||||
end
|
||||
end
|
||||
|
||||
execute "install-key #{key_name}" do
|
||||
command "apt-key add #{cached_keyfile}"
|
||||
action :run
|
||||
not_if do
|
||||
installed_ids = extract_gpg_ids_from_cmd("apt-key finger")
|
||||
key_ids = extract_gpg_ids_from_cmd("gpg --with-fingerprint #{cached_keyfile}")
|
||||
(installed_ids & key_ids).sort == key_ids.sort
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# build repo file contents
|
||||
def build_repo(uri, distribution, components, arch, add_deb_src)
|
||||
components = components.join(' ') if components.respond_to?(:join)
|
||||
repo_info = "#{uri} #{distribution} #{components}\n"
|
||||
repo_info = "[arch=#{arch}] #{repo_info}" if arch
|
||||
repo = "deb #{repo_info}"
|
||||
repo << "deb-src #{repo_info}" if add_deb_src
|
||||
repo
|
||||
end
|
||||
|
||||
action :add do
|
||||
new_resource.updated_by_last_action(false)
|
||||
@repo_file = nil
|
||||
|
||||
recipe_eval do
|
||||
# add key
|
||||
if new_resource.keyserver && new_resource.key
|
||||
install_key_from_keyserver(new_resource.key, new_resource.keyserver)
|
||||
elsif new_resource.key
|
||||
install_key_from_uri(new_resource.key)
|
||||
end
|
||||
|
||||
file "/var/lib/apt/periodic/update-success-stamp" do
|
||||
action :nothing
|
||||
end
|
||||
|
||||
execute "apt-get update" do
|
||||
ignore_failure true
|
||||
action :nothing
|
||||
end
|
||||
|
||||
# build repo file
|
||||
repository = build_repo(new_resource.uri,
|
||||
new_resource.distribution,
|
||||
new_resource.components,
|
||||
new_resource.arch,
|
||||
new_resource.deb_src)
|
||||
|
||||
@repo_file = file "/etc/apt/sources.list.d/#{new_resource.name}.list" do
|
||||
owner "root"
|
||||
group "root"
|
||||
mode 00644
|
||||
content repository
|
||||
action :create
|
||||
notifies :delete, "file[/var/lib/apt/periodic/update-success-stamp]", :immediately
|
||||
notifies :run, "execute[apt-get update]", :immediately if new_resource.cache_rebuild
|
||||
end
|
||||
end
|
||||
|
||||
raise RuntimeError, "The repository file to create is nil, cannot continue." if @repo_file.nil?
|
||||
new_resource.updated_by_last_action(@repo_file.updated?)
|
||||
end
|
||||
|
||||
action :remove do
|
||||
if ::File.exists?("/etc/apt/sources.list.d/#{new_resource.name}.list")
|
||||
Chef::Log.info "Removing #{new_resource.name} repository from /etc/apt/sources.list.d/"
|
||||
file "/etc/apt/sources.list.d/#{new_resource.name}.list" do
|
||||
action :delete
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,59 @@
|
|||
#
|
||||
# Cookbook Name:: apt
|
||||
# Recipe:: cacher-client
|
||||
#
|
||||
# Copyright 2011, 2012 Opscode, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
#remove Acquire::http::Proxy lines from /etc/apt/apt.conf since we use 01proxy
|
||||
#these are leftover from preseed installs
|
||||
execute 'Remove proxy from /etc/apt/apt.conf' do
|
||||
command "sed --in-place '/^Acquire::http::Proxy/d' /etc/apt/apt.conf"
|
||||
only_if "grep Acquire::http::Proxy /etc/apt/apt.conf"
|
||||
end
|
||||
|
||||
servers = []
|
||||
if node['apt'] && node['apt']['cacher_ipaddress']
|
||||
cacher = Chef::Node.new
|
||||
cacher.name(node['apt']['cacher_ipaddress'])
|
||||
cacher.ipaddress(node['apt']['cacher_ipaddress'])
|
||||
servers << cacher
|
||||
end
|
||||
|
||||
unless Chef::Config[:solo]
|
||||
query = 'recipes:apt\:\:cacher-ng'
|
||||
query += " AND chef_environment:#{node.chef_environment}" if node['apt']['cacher-client']['restrict_environment']
|
||||
Chef::Log.debug("apt::cacher-client searching for '#{query}'")
|
||||
servers += search(:node, query)
|
||||
end
|
||||
|
||||
if servers.length > 0
|
||||
Chef::Log.info("apt-cacher-ng server found on #{servers[0]}.")
|
||||
template '/etc/apt/apt.conf.d/01proxy' do
|
||||
source '01proxy.erb'
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode 00644
|
||||
variables(
|
||||
:proxy => servers[0]['ipaddress'],
|
||||
:port => node['apt']['cacher_port']
|
||||
)
|
||||
end.run_action(:create)
|
||||
else
|
||||
Chef::Log.info('No apt-cacher-ng server found.')
|
||||
file '/etc/apt/apt.conf.d/01proxy' do
|
||||
action :delete
|
||||
end
|
||||
end
|
|
@ -0,0 +1,43 @@
|
|||
#
|
||||
# Cookbook Name:: apt
|
||||
# Recipe:: cacher-ng
|
||||
#
|
||||
# Copyright 2008-2012, Opscode, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package "apt-cacher-ng" do
|
||||
action :install
|
||||
end
|
||||
|
||||
service "apt-cacher-ng" do
|
||||
supports :restart => true, :status => false
|
||||
action :enable
|
||||
end
|
||||
|
||||
template "/etc/apt-cacher-ng/acng.conf" do
|
||||
source "acng.conf.erb"
|
||||
owner "root"
|
||||
group "root"
|
||||
mode 00644
|
||||
notifies :restart, "service[apt-cacher-ng]"
|
||||
end
|
||||
|
||||
# Reopen resource w/ start in case config issue causes startup to fail
|
||||
service "apt-cacher-ng" do
|
||||
action :start
|
||||
end
|
||||
|
||||
#this will help seed the proxy
|
||||
include_recipe "apt::cacher-client"
|
|
@ -0,0 +1,68 @@
|
|||
#
|
||||
# Cookbook Name:: apt
|
||||
# Recipe:: default
|
||||
#
|
||||
# Copyright 2008-2011, Opscode, Inc.
|
||||
# Copyright 2009, Bryan McLellan <btm@loftninjas.org>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
# Run apt-get update to create the stamp file
|
||||
execute "apt-get-update" do
|
||||
command "apt-get update"
|
||||
ignore_failure true
|
||||
not_if do ::File.exists?('/var/lib/apt/periodic/update-success-stamp') end
|
||||
end
|
||||
|
||||
# For other recipes to call to force an update
|
||||
execute "apt-get update" do
|
||||
command "apt-get update"
|
||||
ignore_failure true
|
||||
action :nothing
|
||||
end
|
||||
|
||||
# Automatically remove packages that are no longer needed for dependencies
|
||||
execute "apt-get autoremove" do
|
||||
command "apt-get -y autoremove"
|
||||
action :nothing
|
||||
end
|
||||
|
||||
# Automatically remove .deb files for packages no longer on your system
|
||||
execute "apt-get autoclean" do
|
||||
command "apt-get -y autoclean"
|
||||
action :nothing
|
||||
end
|
||||
|
||||
# provides /var/lib/apt/periodic/update-success-stamp on apt-get update
|
||||
package "update-notifier-common" do
|
||||
notifies :run, resources(:execute => "apt-get-update"), :immediately
|
||||
end
|
||||
|
||||
execute "apt-get-update-periodic" do
|
||||
command "apt-get update"
|
||||
ignore_failure true
|
||||
only_if do
|
||||
::File.exists?('/var/lib/apt/periodic/update-success-stamp') &&
|
||||
::File.mtime('/var/lib/apt/periodic/update-success-stamp') < Time.now - 86400
|
||||
end
|
||||
end
|
||||
|
||||
%w{/var/cache/local /var/cache/local/preseeding}.each do |dirname|
|
||||
directory dirname do
|
||||
owner "root"
|
||||
group "root"
|
||||
mode 00755
|
||||
action :create
|
||||
end
|
||||
end
|
|
@ -0,0 +1,29 @@
|
|||
#
|
||||
# Cookbook Name:: apt
|
||||
# Resource:: preference
|
||||
#
|
||||
# Copyright 2010-2011, Opscode, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
actions :add, :remove
|
||||
|
||||
def initialize(*args)
|
||||
super
|
||||
@action = :add
|
||||
end
|
||||
|
||||
attribute :package_name, :kind_of => String, :name_attribute => true
|
||||
attribute :pin, :kind_of => String
|
||||
attribute :pin_priority, :kind_of => String
|
|
@ -0,0 +1,40 @@
|
|||
#
|
||||
# Cookbook Name:: apt
|
||||
# Resource:: repository
|
||||
#
|
||||
# Copyright 2010-2011, Opscode, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
actions :add, :remove
|
||||
|
||||
def initialize(*args)
|
||||
super
|
||||
@action = :add
|
||||
end
|
||||
|
||||
#name of the repo, used for source.list filename
|
||||
attribute :repo_name, :kind_of => String, :name_attribute => true
|
||||
attribute :uri, :kind_of => String
|
||||
attribute :distribution, :kind_of => String
|
||||
attribute :components, :kind_of => Array, :default => []
|
||||
attribute :arch, :kind_of => String, :default => nil
|
||||
#whether or not to add the repository as a source repo as well
|
||||
attribute :deb_src, :default => false
|
||||
attribute :keyserver, :kind_of => String, :default => nil
|
||||
attribute :key, :kind_of => String, :default => nil
|
||||
attribute :cookbook, :kind_of => String, :default => nil
|
||||
#trigger cache rebuild
|
||||
#If not you can trigger in the recipe itself after checking the status of resource.updated{_by_last_action}?
|
||||
attribute :cache_rebuild, :kind_of => [TrueClass, FalseClass], :default => true
|
|
@ -0,0 +1,2 @@
|
|||
Acquire::http::Proxy "http://<%= @proxy %>:<%= @port %>";
|
||||
Acquire::https::Proxy "DIRECT";
|
|
@ -0,0 +1,276 @@
|
|||
|
||||
# Letter case in directive names does not matter. Must be separated with colons.
|
||||
# Valid boolean values are a zero number for false, non-zero numbers for true.
|
||||
|
||||
CacheDir: /var/cache/apt-cacher-ng
|
||||
|
||||
# set empty to disable logging
|
||||
LogDir: /var/log/apt-cacher-ng
|
||||
|
||||
# place to look for additional configuration and resource files if they are not
|
||||
# found in the configuration directory
|
||||
# SupportDir: /usr/lib/apt-cacher-ng
|
||||
|
||||
# TCP (http) port
|
||||
# Set to 9999 to emulate apt-proxy
|
||||
Port:<%= node['apt']['cacher_port'] %>
|
||||
|
||||
# Addresses or hostnames to listen on. Multiple addresses must be separated by
|
||||
# spaces. Each entry must be an exact local address which is associated with a
|
||||
# local interface. DNS resolution is performed using getaddrinfo(3) for all
|
||||
# available protocols (IPv4, IPv6, ...). Using a protocol specific format will
|
||||
# create binding(s) only on protocol specific socket(s) (e.g. 0.0.0.0 will listen
|
||||
# only to IPv4).
|
||||
#
|
||||
# Default: not set, will listen on all interfaces and protocols
|
||||
#
|
||||
# BindAddress: localhost 192.168.7.254 publicNameOnMainInterface
|
||||
|
||||
# The specification of another proxy which shall be used for downloads.
|
||||
# Username and password are, and see manual for limitations.
|
||||
#
|
||||
#Proxy: http://www-proxy.example.net:80
|
||||
#proxy: username:proxypassword@proxy.example.net:3128
|
||||
|
||||
# Repository remapping. See manual for details.
|
||||
# In this example, some backends files might be generated during package
|
||||
# installation using information collected on the system.
|
||||
Remap-debrep: file:deb_mirror*.gz /debian ; file:backends_debian # Debian Archives
|
||||
Remap-uburep: file:ubuntu_mirrors /ubuntu ; file:backends_ubuntu # Ubuntu Archives
|
||||
Remap-debvol: file:debvol_mirror*.gz /debian-volatile ; file:backends_debvol # Debian Volatile Archives
|
||||
Remap-cygwin: file:cygwin_mirrors /cygwin # ; file:backends_cygwin # incomplete, please create this file or specify preferred mirrors here
|
||||
Remap-sfnet: file:sfnet_mirrors # ; file:backends_sfnet # incomplete, please create this file or specify preferred mirrors here
|
||||
Remap-alxrep: file:archlx_mirrors /archlinux # ; file:backend_archlx # Arch Linux
|
||||
Remap-fedora: file:fedora_mirrors # Fedora Linux
|
||||
Remap-epel: file:epel_mirrors # Fedora EPEL
|
||||
Remap-slrep: file:sl_mirrors # Scientific Linux
|
||||
|
||||
# This is usually not needed for security.debian.org because it's always the
|
||||
# same DNS hostname. However, it might be enabled in order to use hooks,
|
||||
# ForceManaged mode or special flags in this context.
|
||||
# Remap-secdeb: security.debian.org
|
||||
|
||||
# Virtual page accessible in a web browser to see statistics and status
|
||||
# information, i.e. under http://localhost:3142/acng-report.html
|
||||
ReportPage: acng-report.html
|
||||
|
||||
# Socket file for accessing through local UNIX socket instead of TCP/IP. Can be
|
||||
# used with inetd bridge or cron client.
|
||||
# SocketPath:/var/run/apt-cacher-ng/socket
|
||||
|
||||
# Forces log file to be written to disk after every line when set to 1. Default
|
||||
# is 0, buffers are flushed when the client disconnects.
|
||||
#
|
||||
# (technically, alias to the Debug option, see its documentation for details)
|
||||
#
|
||||
# UnbufferLogs: 0
|
||||
|
||||
# Set to 0 to store only type, time and transfer sizes.
|
||||
# 1 -> client IP and relative local path are logged too
|
||||
# VerboseLog: 1
|
||||
|
||||
# Don't detach from the console
|
||||
# ForeGround: 0
|
||||
|
||||
# Store the pid of the daemon process therein
|
||||
# PidFile: /var/run/apt-cacher-ng/pid
|
||||
|
||||
# Forbid outgoing connections, work around them or respond with 503 error
|
||||
# offlinemode:0
|
||||
|
||||
# Forbid all downloads that don't run through preconfigured backends (.where)
|
||||
#ForceManaged: 0
|
||||
|
||||
# Days before considering an unreferenced file expired (to be deleted).
|
||||
# Warning: if the value is set too low and particular index files are not
|
||||
# available for some days (mirror downtime) there is a risk of deletion of
|
||||
# still useful package files.
|
||||
ExTreshold: 4
|
||||
|
||||
# Stop expiration when a critical problem appeared. Currently only failed
|
||||
# refresh of an index file is considered as critical.
|
||||
#
|
||||
# WARNING: don't touch this option or set to zero.
|
||||
# Anything else is DANGEROUS and may cause data loss.
|
||||
#
|
||||
# ExAbortOnProblems: 1
|
||||
|
||||
# Replace some Windows/DOS-FS incompatible chars when storing
|
||||
# StupidFs: 0
|
||||
|
||||
# Experimental feature for apt-listbugs: pass-through SOAP requests and
|
||||
# responses to/from bugs.debian.org. If not set, default is true if
|
||||
# ForceManaged is enabled and false otherwise.
|
||||
# ForwardBtsSoap: 1
|
||||
|
||||
# The daemon has a small cache for DNS data, to speed up resolution. The
|
||||
# expiration time of the DNS entries can be configured in seconds.
|
||||
# DnsCacheSeconds: 3600
|
||||
|
||||
# Don't touch the following values without good consideration!
|
||||
#
|
||||
# Max. count of connection threads kept ready (for faster response in the
|
||||
# future). Should be a sane value between 0 and average number of connections,
|
||||
# and depend on the amount of spare RAM.
|
||||
# MaxStandbyConThreads: 8
|
||||
#
|
||||
# Hard limit of active thread count for incoming connections, i.e. operation
|
||||
# is refused when this value is reached (below zero = unlimited).
|
||||
# MaxConThreads: -1
|
||||
#
|
||||
# Pigeonholing files with regular expressions (static/volatile). Can be
|
||||
# overriden here but not should not be done permanently because future update
|
||||
# of default settings would not be applied later.
|
||||
# VfilePattern = (^|.*?/)(Index|Packages(\.gz|\.bz2|\.lzma|\.xz)?|InRelease|Release|Release\.gpg|Sources(\.gz|\.bz2|\.lzma|\.xz)?|release|index\.db-.*\.gz|Contents-[^/]*(\.gz|\.bz2|\.lzma|\.xz)?|pkglist[^/]*\.bz2|rclist[^/]*\.bz2|/meta-release[^/]*|Translation[^/]*(\.gz|\.bz2|\.lzma|\.xz)?|MD5SUMS|SHA1SUMS|((setup|setup-legacy)(\.ini|\.bz2|\.hint)(\.sig)?)|mirrors\.lst|repo(index|md)\.xml(\.asc|\.key)?|directory\.yast|products|content(\.asc|\.key)?|media|filelists\.xml\.gz|filelists\.sqlite\.bz2|repomd\.xml|packages\.[a-zA-Z][a-zA-Z]\.gz|info\.txt|license\.tar\.gz|license\.zip|.*\.db(\.tar\.gz)?|.*\.files\.tar\.gz|.*\.abs\.tar\.gz|metalink\?repo|.*prestodelta\.xml\.gz)$|/dists/.*/installer-[^/]+/[^0-9][^/]+/images/.*
|
||||
# PfilePattern = .*(\.d?deb|\.rpm|\.dsc|\.tar(\.gz|\.bz2|\.lzma|\.xz)(\.gpg)?|\.diff(\.gz|\.bz2|\.lzma|\.xz)|\.jigdo|\.template|changelog|copyright|\.udeb|\.debdelta|\.diff/.*\.gz|(Devel)?ReleaseAnnouncement(\?.*)?|[a-f0-9]+-(susedata|updateinfo|primary|deltainfo).xml.gz|fonts/(final/)?[a-z]+32.exe(\?download.*)?|/dists/.*/installer-[^/]+/[0-9][^/]+/images/.*)$
|
||||
# Whitelist for expiration, file types not to be removed even when being
|
||||
# unreferenced. Default: many parts from VfilePattern where no parent index
|
||||
# exists or might be unknown.
|
||||
# WfilePattern = (^|.*?/)(Release|InRelease|Release\.gpg|(Packages|Sources)(\.gz|\.bz2|\.lzma|\.xz)?|Translation[^/]*(\.gz|\.bz2|\.lzma|\.xz)?|MD5SUMS|SHA1SUMS|.*\.xml|.*\.db\.tar\.gz|.*\.files\.tar\.gz|.*\.abs\.tar\.gz|[a-z]+32.exe)$|/dists/.*/installer-.*/images/.*
|
||||
|
||||
# Higher modes only working with the debug version
|
||||
# Warning, writes a lot into apt-cacher.err logfile
|
||||
# Value overwrites UnbufferLogs setting (aliased)
|
||||
# Debug:3
|
||||
|
||||
# Usually, general purpose proxies like Squid expose the IP address of the
|
||||
# client user to the remote server using the X-Forwarded-For HTTP header. This
|
||||
# behaviour can be optionally turned on with the Expose-Origin option.
|
||||
# ExposeOrigin: 0
|
||||
|
||||
# When logging the originating IP address, trust the information supplied by
|
||||
# the client in the X-Forwarded-For header.
|
||||
# LogSubmittedOrigin: 0
|
||||
|
||||
# The version string reported to the peer, to be displayed as HTTP client (and
|
||||
# version) in the logs of the mirror.
|
||||
# WARNING: some archives use this header to detect/guess capabilities of the
|
||||
# client (i.e. redirection support) and change the behaviour accordingly, while
|
||||
# ACNG might not support the expected features. Expect side effects.
|
||||
#
|
||||
# UserAgent: Yet Another HTTP Client/1.2.3p4
|
||||
|
||||
# In some cases the Import and Expiration tasks might create fresh volatile
|
||||
# data for internal use by reconstructing them using patch files. This
|
||||
# by-product might be recompressed with bzip2 and with some luck the resulting
|
||||
# file becomes identical to the *.bz2 file on the server, usable for APT
|
||||
# clients trying to fetch the full .bz2 compressed version. Injection of the
|
||||
# generated files into the cache has however a disadvantage on underpowered
|
||||
# servers: bzip2 compression can create high load on the server system and the
|
||||
# visible download of the busy .bz2 files also becomes slower.
|
||||
#
|
||||
# RecompBz2: 0
|
||||
|
||||
# Network timeout for outgoing connections.
|
||||
# NetworkTimeout: 60
|
||||
|
||||
# Sometimes it makes sense to not store the data in cache and just return the
|
||||
# package data to client as it comes in. DontCache parameters can enable this
|
||||
# behaviour for certain URL types. The tokens are extended regular expressions
|
||||
# that URLs are matched against.
|
||||
#
|
||||
# DontCacheRequested is applied to the URL as it comes in from the client.
|
||||
# Example: exclude packages built with kernel-package for x86
|
||||
# DontCacheRequested: linux-.*_10\...\.Custo._i386
|
||||
# Example usecase: exclude popular private IP ranges from caching
|
||||
# DontCacheRequested: 192.168.0 ^10\..* 172.30
|
||||
#
|
||||
# DontCacheResolved is applied to URLs after mapping to the target server. If
|
||||
# multiple backend servers are specified then it's only matched against the
|
||||
# download link for the FIRST possible source (due to implementation limits).
|
||||
# Example usecase: all Ubuntu stuff comes from a local mirror (specified as
|
||||
# backend), don't cache it again:
|
||||
# DontCacheResolved: ubuntumirror.local.net
|
||||
#
|
||||
# DontCache directive sets (overrides) both, DontCacheResolved and
|
||||
# DontCacheRequested. Provided for convenience, see those directives for
|
||||
# details.
|
||||
#
|
||||
# Default permission set of freshly created files and directories, as octal
|
||||
# numbers (see chmod(1) for details).
|
||||
# Can by limited by the umask value (see umask(2) for details) if it's set in
|
||||
# the environment of the starting shell, e.g. in apt-cacher-ng init script or
|
||||
# in its configuration file.
|
||||
# DirPerms: 00755
|
||||
# FilePerms: 00664
|
||||
#
|
||||
#
|
||||
# It's possible to use use apt-cacher-ng as a regular web server with limited
|
||||
# feature set, i.e.
|
||||
# including directory browsing and download of any file;
|
||||
# excluding sorting, mime types/encodings, CGI execution, index page
|
||||
# redirection and other funny things.
|
||||
# To get this behavior, mappings between virtual directories and real
|
||||
# directories on the server must be defined with the LocalDirs directive.
|
||||
# Virtual and real dirs are separated by spaces, multiple pairs are separated
|
||||
# by semi-colons. Real directories must be absolute paths.
|
||||
# NOTE: Since the names of that key directories share the same namespace as
|
||||
# repository names (see Remap-...) it's administrators job to avoid such
|
||||
# collisions on them (unless created deliberately).
|
||||
#
|
||||
# LocalDirs: woo /data/debarchive/woody ; hamm /data/debarchive/hamm
|
||||
|
||||
# Precache a set of files referenced by specified index files. This can be used
|
||||
# to create a partial mirror usable for offline work. There are certain limits
|
||||
# and restrictions on the path specification, see manual for details. A list of
|
||||
# (maybe) relevant index files could be retrieved via
|
||||
# "apt-get --print-uris update" on a client machine.
|
||||
#
|
||||
# PrecacheFor: debrep/dists/unstable/*/source/Sources* debrep/dists/unstable/*/binary-amd64/Packages*
|
||||
|
||||
# Arbitrary set of data to append to request headers sent over the wire. Should
|
||||
# be a well formated HTTP headers part including newlines (DOS style) which
|
||||
# can be entered as escape sequences (\r\n).
|
||||
# RequestAppendix: X-Tracking-Choice: do-not-track\r\n
|
||||
|
||||
# Specifies the IP protocol families to use for remote connections. Order does
|
||||
# matter, first specified are considered first. Possible combinations:
|
||||
# v6 v4
|
||||
# v4 v6
|
||||
# v6
|
||||
# v4
|
||||
# (empty or not set: use system default)
|
||||
#
|
||||
# ConnectProto: v6 v4
|
||||
|
||||
# Regular expiration algorithm finds package files which are no longer listed
|
||||
# in any index file and removes them of them after a safety period.
|
||||
# This option allows to keep more versions of a package in the cache after
|
||||
# safety period is over.
|
||||
# KeepExtraVersions: 1
|
||||
|
||||
# Optionally uses TCP access control provided by libwrap, see hosts_access(5)
|
||||
# for details. Daemon name is apt-cacher-ng. Default if not set: decided on
|
||||
# startup by looking for explicit mentioning of apt-cacher-ng in
|
||||
# /etc/hosts.allow or /etc/hosts.deny files.
|
||||
# UseWrap: 0
|
||||
|
||||
# If many machines from the same local network attempt to update index files
|
||||
# (apt-get update) at nearly the same time, the known state of these index file
|
||||
# is temporarily frozen and multiple requests receive the cached response
|
||||
# without contacting the server. This parameter (in seconds) specifies the
|
||||
# length of this period before the files are considered outdated.
|
||||
# Setting it too low transfers more data and increases remote server load,
|
||||
# setting it too high (more than a couple of minutes) increases the risk of
|
||||
# delivering inconsistent responses to the clients.
|
||||
# FreshIndexMaxAge: 27
|
||||
|
||||
# Usually the users are not allowed to specify custom TCP ports of remote
|
||||
# mirrors in the requests, only the default HTTP port can be used (instead,
|
||||
# proxy administrator can create Remap- rules with custom ports). This
|
||||
# restriction can be disabled by specifying a list of allowed ports or 0 for
|
||||
# any port.
|
||||
#
|
||||
# AllowUserPorts: 80
|
||||
|
||||
# Normally the HTTP redirection responses are forwarded to the original caller
|
||||
# (i.e. APT) which starts a new download attempt from the new URL. This
|
||||
# solution is ok for client configurations with proxy mode but doesn't work
|
||||
# well with configurations using URL prefixes. To work around this the server
|
||||
# can restart its own download with another URL. However, this might be used to
|
||||
# circumvent download source policies by malicious users.
|
||||
# The RedirMax option specifies how many such redirects the server should
|
||||
# follow per request, 0 disables the internal redirection. If not set,
|
||||
# default value is 0 if ForceManaged is used and 5 otherwise.
|
||||
#
|
||||
# RedirMax: 5
|
|
@ -0,0 +1,4 @@
|
|||
.bundle
|
||||
.cache
|
||||
.kitchen
|
||||
bin
|
|
@ -0,0 +1,35 @@
|
|||
## v1.3.4:
|
||||
|
||||
* [COOK-2272] - Complete `platform_family` conversion in build-essential
|
||||
|
||||
## v1.3.2:
|
||||
|
||||
* [COOK-2069] - build-essential will install osx-gcc-installer when
|
||||
Xcode is present
|
||||
|
||||
## v1.3.0:
|
||||
|
||||
* [COOK-1895] - support smartos
|
||||
|
||||
## v1.2.0:
|
||||
|
||||
* Add test-kitchen support (source repo only)
|
||||
* [COOK-1677] - build-essential cookbook support for OpenSuse and SLES
|
||||
* [COOK-1718] - build-essential cookbook metadata should include scientific
|
||||
* [COOK-1768] - The apt-get update in build-essentials needs to be renamed
|
||||
|
||||
## v1.1.2:
|
||||
|
||||
* [COOK-1620] - support OS X 10.8
|
||||
|
||||
## v1.1.0:
|
||||
|
||||
* [COOK-1098] - support amazon linux
|
||||
* [COOK-1149] - support Mac OS X
|
||||
* [COOK-1296] - allow for compile-time installation of packages
|
||||
through an attribute (see README)
|
||||
|
||||
## v1.0.2:
|
||||
|
||||
* [COOK-1098] - Add Amazon Linux platform support
|
||||
* [COOK-1149] - Add OS X platform support
|
|
@ -0,0 +1,29 @@
|
|||
If you would like to contribute, please open a ticket in JIRA:
|
||||
|
||||
* http://tickets.opscode.com
|
||||
|
||||
Create the ticket in the COOK project and use the cookbook name as the
|
||||
component.
|
||||
|
||||
For all code contributions, we ask that contributors sign a
|
||||
contributor license agreement (CLA). Instructions may be found here:
|
||||
|
||||
* http://wiki.opscode.com/display/chef/How+to+Contribute
|
||||
|
||||
When contributing changes to individual cookbooks, please do not
|
||||
modify the version number in the metadata.rb. Also please do not
|
||||
update the CHANGELOG.md for a new version. Not all changes to a
|
||||
cookbook may be merged and released in the same versions. Opscode will
|
||||
handle the version updates during the release process. You are welcome
|
||||
to correct typos or otherwise make updates to documentation in the
|
||||
README.
|
||||
|
||||
If a contribution adds new platforms or platform versions, indicate
|
||||
such in the body of the commit message(s), and update the relevant
|
||||
COOK ticket. When writing commit messages, it is helpful for others if
|
||||
you indicate the COOK ticket. For example:
|
||||
|
||||
git commit -m '[COOK-1041] Updated pool resource to correctly delete.'
|
||||
|
||||
In the ticket itself, it is also helpful if you include log output of
|
||||
a successful Chef run, but this is not absolutely required.
|
|
@ -0,0 +1,3 @@
|
|||
source :rubygems
|
||||
|
||||
gem 'test-kitchen', '<= 1.0'
|
|
@ -0,0 +1,201 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
|
@ -0,0 +1,131 @@
|
|||
Description
|
||||
===========
|
||||
|
||||
Installs packages required for compiling C software from source. Use
|
||||
this cookbook if you wish to compile C programs, or install RubyGems
|
||||
with native extensions.
|
||||
|
||||
Requirements
|
||||
============
|
||||
|
||||
Chef version 0.10.10+ and Ohai 0.6.12+ are required.
|
||||
|
||||
## Platform
|
||||
|
||||
Supported platforms by platform family:
|
||||
|
||||
* Linux (fedora redhat centos ubuntu debian amazon scientific)
|
||||
* Darwin (`mac_os_x` 10.6+)
|
||||
* SmartOs
|
||||
|
||||
## Cookbooks
|
||||
|
||||
Requires `pkgin` cookbook on SmartOS
|
||||
|
||||
Attributes
|
||||
==========
|
||||
|
||||
* `node['build_essential']['compiletime']` - Whether the resources in
|
||||
the default recipe should be configured at the "Compile" phase of the
|
||||
Chef run. Defaults to false, see __Usage__ for more information.
|
||||
* `node['build_essential']['osx']['gcc_installer_url']` - The URL of
|
||||
the OS X GCC package installer (.pkg).
|
||||
* `node['build_essential']['osx']['gcc_installer_checksum']` - The
|
||||
SHA256 checksum of the OS X GCC installer.
|
||||
|
||||
Recipes
|
||||
=======
|
||||
|
||||
This cookbook has one recipe, default.
|
||||
|
||||
On Linux platforms (see __Platform__ above for a supported list of
|
||||
families), packages required to build C source projects are installed.
|
||||
This includes GCC, make, autconf and others. On Debian-family
|
||||
distributions, the apt-cache may need to be updated, especially during
|
||||
compile time installation. See __Usage__ for further information.
|
||||
|
||||
On Mac OS X, the GCC standalone installer by Kenneth Reitz is
|
||||
installed. Note that this is *not* the Xcode CLI package, as that does
|
||||
not include all programs and headers required to build some common
|
||||
GNU-style C projects, such as those that are available from projects
|
||||
such as MacPorts or Homebrew. Changing the attributes for the GCC
|
||||
installer URL and checksum to the Xcode values may work, but this is
|
||||
untested.
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
Simply include the `build-essential` and the required tools will be
|
||||
installed to the system, and later recipes will be able to compile
|
||||
software from C source code.
|
||||
|
||||
For RubyGems that include native C extensions you wish to use with
|
||||
Chef, you should do two things.
|
||||
|
||||
0. Ensure that the C libraries, include files and other assorted "dev"
|
||||
type packages are installed. You should do this in the compile phase
|
||||
after the build-essential recipe.
|
||||
1. Use the `chef_gem` resource in your recipes. This requires Chef version 0.10.10+.
|
||||
2. Set the `compiletime` attribute in roles where such recipes are
|
||||
required. This will ensure that the build tools are available to
|
||||
compile the RubyGems' extensions, as `chef_gem` happens during the
|
||||
compile phase, too.
|
||||
|
||||
Example installation of a devel package at compile-time in a recipe:
|
||||
|
||||
package "mypackage-dev" do
|
||||
action :nothing
|
||||
end.run_action(:install)
|
||||
|
||||
Example use of `chef_gem`:
|
||||
|
||||
chef_gem "mygem"
|
||||
|
||||
Example role:
|
||||
|
||||
name "myapp"
|
||||
run_list(
|
||||
"recipe[build-essential]",
|
||||
"recipe[myapp]"
|
||||
)
|
||||
default_attributes(
|
||||
"build_essential" => {
|
||||
"compiletime" => true
|
||||
}
|
||||
)
|
||||
|
||||
The compile time option (via the attribute) is to ensure that the
|
||||
proper packages are available at the right time in the Chef run. It is
|
||||
recommended that the build-essential recipe appear early in the run
|
||||
list.
|
||||
|
||||
The Chef wiki has documentation on
|
||||
[the anatomy of a chef run](http://wiki.opscode.com/display/chef/Anatomy+of+a+Chef+Run).
|
||||
|
||||
Limitations
|
||||
===========
|
||||
|
||||
It is not in the scope of this cookbook to handle installing the
|
||||
required headers for individual software projects in order to compile
|
||||
them, or to compile RubyGems with native C extensions. You should
|
||||
create a cookbook for handling that.
|
||||
|
||||
License and Author
|
||||
==================
|
||||
|
||||
Author:: Joshua Timberman (<joshua@opscode.com>)
|
||||
Author:: Seth Chisamore (<schisamo@opscode.com>)
|
||||
|
||||
Copyright 2009-2011, Opscode, Inc. (<legal@opscode.com>)
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
|
@ -0,0 +1,33 @@
|
|||
#
|
||||
# Cookbook Name:: build-essential
|
||||
# Attributes:: default
|
||||
#
|
||||
# Copyright 2008-2012, Opscode, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
default['build_essential']['compiletime'] = false
|
||||
|
||||
case node['platform_family']
|
||||
when "mac_os_x"
|
||||
case
|
||||
when Chef::VersionConstraint.new("~> 10.7.0").include?(node['platform_version']),
|
||||
Chef::VersionConstraint.new("~> 10.8.0").include?(node['platform_version'])
|
||||
default['build_essential']['osx']['gcc_installer_url'] = "https://github.com/downloads/kennethreitz/osx-gcc-installer/GCC-10.7-v2.pkg"
|
||||
default['build_essential']['osx']['gcc_installer_checksum'] = "df36aa87606feb99d0db9ac9a492819e"
|
||||
when Chef::VersionConstraint.new("~> 10.6.0").include?(node['platform_version'])
|
||||
default['build_essential']['osx']['gcc_installer_url'] = "https://github.com/downloads/kennethreitz/osx-gcc-installer/GCC-10.6.pkg"
|
||||
default['build_essential']['osx']['gcc_installer_checksum'] = "d1db5bab6a3f6b9f3b5577a130baeefa"
|
||||
end
|
||||
end
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"name": "build-essential",
|
||||
"description": "Installs C compiler / build tools",
|
||||
"long_description": "",
|
||||
"maintainer": "Opscode, Inc.",
|
||||
"maintainer_email": "cookbooks@opscode.com",
|
||||
"license": "Apache 2.0",
|
||||
"platforms": {
|
||||
"fedora": ">= 0.0.0",
|
||||
"redhat": ">= 0.0.0",
|
||||
"centos": ">= 0.0.0",
|
||||
"ubuntu": ">= 0.0.0",
|
||||
"debian": ">= 0.0.0",
|
||||
"amazon": ">= 0.0.0",
|
||||
"suse": ">= 0.0.0",
|
||||
"scientific": ">= 0.0.0",
|
||||
"oracle": ">= 0.0.0",
|
||||
"smartos": ">= 0.0.0",
|
||||
"mac_os_x": ">= 10.6.0",
|
||||
"mac_os_x_server": ">= 10.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
},
|
||||
"recommendations": {
|
||||
},
|
||||
"suggestions": {
|
||||
"pkgin": ">= 0.0.0"
|
||||
},
|
||||
"conflicting": {
|
||||
},
|
||||
"providing": {
|
||||
},
|
||||
"replacing": {
|
||||
},
|
||||
"attributes": {
|
||||
},
|
||||
"groupings": {
|
||||
},
|
||||
"recipes": {
|
||||
"build-essential": "Installs packages required for compiling C software from source."
|
||||
},
|
||||
"version": "1.3.4"
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
name "build-essential"
|
||||
maintainer "Opscode, Inc."
|
||||
maintainer_email "cookbooks@opscode.com"
|
||||
license "Apache 2.0"
|
||||
description "Installs C compiler / build tools"
|
||||
version "1.3.4"
|
||||
recipe "build-essential", "Installs packages required for compiling C software from source."
|
||||
|
||||
%w{ fedora redhat centos ubuntu debian amazon suse scientific oracle smartos}.each do |os|
|
||||
supports os
|
||||
end
|
||||
|
||||
supports "mac_os_x", ">= 10.6.0"
|
||||
supports "mac_os_x_server", ">= 10.6.0"
|
||||
suggests "pkgin"
|
|
@ -0,0 +1,92 @@
|
|||
#
|
||||
# Cookbook Name:: build-essential
|
||||
# Recipe:: default
|
||||
#
|
||||
# Copyright 2008-2009, Opscode, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
require 'chef/shell_out'
|
||||
|
||||
compiletime = node['build_essential']['compiletime']
|
||||
|
||||
case node['platform_family']
|
||||
when "rhel", "suse", "fedora", "debian"
|
||||
|
||||
# on apt-based platforms when first provisioning we need to force
|
||||
# apt-get update at compiletime if we are going to try to install at compiletime
|
||||
if node['platform_family'] == "debian"
|
||||
execute "apt-get-update-build-essentials" do
|
||||
command "apt-get update"
|
||||
action :nothing
|
||||
# tip: to suppress this running every time, just use the apt cookbook
|
||||
not_if do
|
||||
::File.exists?('/var/lib/apt/periodic/update-success-stamp') &&
|
||||
::File.mtime('/var/lib/apt/periodic/update-success-stamp') > Time.now - 86400*2
|
||||
end
|
||||
end.run_action(:run) if compiletime
|
||||
end
|
||||
|
||||
packages = case node['platform_family']
|
||||
when "debian"
|
||||
%w{build-essential binutils-doc}
|
||||
when "rhel", "fedora"
|
||||
%w{gcc gcc-c++ kernel-devel make}
|
||||
when "suse"
|
||||
%w{gcc gcc-c++ kernel-default-devel make m4} # in SLES there is no kernel-devel
|
||||
end
|
||||
|
||||
packages.each do |pkg|
|
||||
r = package pkg do
|
||||
action ( compiletime ? :nothing : :install )
|
||||
end
|
||||
r.run_action(:install) if compiletime
|
||||
end
|
||||
|
||||
%w{autoconf flex bison}.each do |pkg|
|
||||
r = package pkg do
|
||||
action ( compiletime ? :nothing : :install )
|
||||
end
|
||||
r.run_action(:install) if compiletime
|
||||
end
|
||||
|
||||
when "smartos"
|
||||
include_recipe 'pkgin'
|
||||
%w{gcc47 gcc47-runtime scmgit-base gmake pkg-config binutils}.each do |package|
|
||||
pkgin_package package do
|
||||
action :install
|
||||
end
|
||||
end
|
||||
|
||||
when "mac_os_x"
|
||||
result = Chef::ShellOut.new("pkgutil --pkgs").run_command
|
||||
osx_gcc_installer_installed = result.stdout.split("\n").include?("com.apple.pkg.gcc4.2Leo")
|
||||
developer_tools_cli_installed = result.stdout.split("\n").include?("com.apple.pkg.DeveloperToolsCLI")
|
||||
pkg_filename = File.basename(node['build_essential']['osx']['gcc_installer_url'])
|
||||
pkg_path = "#{Chef::Config[:file_cache_path]}/#{pkg_filename}"
|
||||
|
||||
r = remote_file pkg_path do
|
||||
source node['build_essential']['osx']['gcc_installer_url']
|
||||
checksum node['build_essential']['osx']['gcc_installer_checksum']
|
||||
action ( compiletime ? :nothing : :create )
|
||||
not_if { osx_gcc_installer_installed or developer_tools_cli_installed }
|
||||
end
|
||||
r.run_action(:create) if compiletime
|
||||
|
||||
r = execute "sudo installer -pkg \"#{pkg_path}\" -target /" do
|
||||
action ( compiletime ? :nothing : :run )
|
||||
not_if { osx_gcc_installer_installed or developer_tools_cli_installed }
|
||||
end
|
||||
r.run_action(:run) if compiletime
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
.bundle
|
||||
.cache
|
||||
.kitchen
|
||||
bin
|
||||
Gemfile.lock
|
|
@ -0,0 +1,38 @@
|
|||
v0.1.2
|
||||
======
|
||||
* Fix regression on debian package path construction (thanks [ashmere](https://github.com/ashmere))
|
||||
|
||||
v0.1.1
|
||||
======
|
||||
* Search for proper version suffix if not provided (removes default '-1')
|
||||
* Do not allow release clients by default when version search is enabled
|
||||
* Push omnibus package installation to the end of run (reduces issue described in #10)
|
||||
* Allow updater to be disabled via attribute (thanks [Teemu Matilainen](https://github.com/tmatilai))
|
||||
|
||||
v0.1.0
|
||||
======
|
||||
* Fix redhat related versioning issues
|
||||
* Remove requirement for '-1' suffix on versions
|
||||
* Initial support for automatic latest version install
|
||||
|
||||
v0.0.5
|
||||
======
|
||||
* Add support for Ubuntu 12.10
|
||||
* Path fixes for non-64 bit packages (thanks [ashmere](https://github.com/ashmere))
|
||||
|
||||
v0.0.4
|
||||
======
|
||||
* Use new aws bucket by default
|
||||
* Update file key building
|
||||
|
||||
v0.0.3
|
||||
======
|
||||
* Path fix for debian omnibus packages (thanks [ashmere](https://github.com/ashmere))
|
||||
|
||||
v0.0.2
|
||||
======
|
||||
* Add robust check when uninstalling chef gem to prevent removal from omnibus
|
||||
|
||||
v0.0.1
|
||||
======
|
||||
* Initial release
|
|
@ -0,0 +1,3 @@
|
|||
source :rubygems
|
||||
|
||||
gem 'test-kitchen'
|
|
@ -0,0 +1,82 @@
|
|||
OmnibusUpdater
|
||||
==============
|
||||
|
||||
Update your omnibus! This cookbook can install the omnibus
|
||||
Chef package into your system if you are currently running
|
||||
via gem install, and it can keep your omnibus install up
|
||||
to date.
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
Add the recipe to your run list and specify what version should
|
||||
be installed on the node:
|
||||
|
||||
`knife node run_list add recipe[omnibus_updater]`
|
||||
|
||||
In your role you'll likely want to set the version (it defaults
|
||||
to the 0.10.10 version of Chef):
|
||||
|
||||
```
|
||||
override_attributes(
|
||||
:omnibus_updater => {
|
||||
:version => '10.16.2'
|
||||
}
|
||||
)
|
||||
```
|
||||
|
||||
It can also uninstall Chef from the system Ruby installation
|
||||
if you tell it to:
|
||||
|
||||
```
|
||||
override_attributes(
|
||||
:omnibus_updater => {
|
||||
:remove_chef_system_gem => true
|
||||
}
|
||||
)
|
||||
```
|
||||
---
|
||||
|
||||
If you are using a Chef version earlier than 10.12.0 you may want
|
||||
to take a look at the chef_gem cookbook to ensure gems are going
|
||||
where expected.
|
||||
|
||||
---
|
||||
|
||||
The default recipe will install the omnibus package based
|
||||
on system information but you can override that by using
|
||||
the `install_via` attribute which accepts: deb, rpm or script.
|
||||
|
||||
Features
|
||||
========
|
||||
|
||||
Auto version expansion
|
||||
----------------------
|
||||
|
||||
Versions for the omnibus installer are defined as: x.y.z-n If the `:version` attribute only provides
|
||||
x.y.z the `n` value will be automatically filled in with the latest available version.
|
||||
|
||||
Auto version searching
|
||||
----------------------
|
||||
|
||||
Using the `:version_search` attribute, the latest stable version of the omnibus installer will
|
||||
be installed automatically as they become available.
|
||||
|
||||
Release clients
|
||||
---------------
|
||||
|
||||
Release clients can be installed via the auto-installation using `:allow_release_clients` attribute.
|
||||
|
||||
Disable
|
||||
-------
|
||||
|
||||
If you want to disable the updater you can set the `disabled`
|
||||
attribute to true. This might be useful if the cookbook is added
|
||||
to a role but should then be skipped for example on a Chef server.
|
||||
|
||||
Infos
|
||||
=====
|
||||
|
||||
* Repo: https://github.com/hw-cookbooks/omnibus_updater
|
||||
* IRC: Freenode @ #heavywater
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
default[:omnibus_updater][:version] = '10.18.2'
|
||||
default[:omnibus_updater][:version_search] = false
|
||||
default[:omnibus_updater][:base_uri] = 'http://opscode-omnitruck-release.s3.amazonaws.com'
|
||||
default[:omnibus_updater][:cache_dir] = '/opt'
|
||||
default[:omnibus_updater][:cache_omnibus_installer] = false
|
||||
default[:omnibus_updater][:remove_chef_system_gem] = false
|
||||
default[:omnibus_updater][:allow_release_clients] = false
|
||||
default[:omnibus_updater][:disabled] = false
|
|
@ -0,0 +1,11 @@
|
|||
module OmnibusChecker
|
||||
def is_omnibus?
|
||||
Gem.bindir =~ %r{/opt/(opscode|chef)/}
|
||||
end
|
||||
end
|
||||
|
||||
OmnibusChecker.send(:extend, OmnibusChecker)
|
||||
|
||||
unless(Chef::Recipe.instance_methods.include?(:is_omnibus?))
|
||||
Chef::Recipe.send(:include, OmnibusChecker)
|
||||
end
|
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"name": "omnibus_updater",
|
||||
"description": "Chef omnibus package updater and installer",
|
||||
"long_description": "OmnibusUpdater\n==============\n\nUpdate your omnibus! This cookbook can install the omnibus\nChef package into your system if you are currently running\nvia gem install, and it can keep your omnibus install up\nto date.\n\nUsage\n=====\n\nAdd the recipe to your run list and specify what version should\nbe installed on the node:\n\n`knife node run_list add recipe[omnibus_updater]`\n\nIn your role you'll likely want to set the version (it defaults\nto the 0.10.10 version of Chef):\n\n```\noverride_attributes(\n :omnibus_updater => {\n :version => '10.16.2'\n }\n)\n```\n\nIt can also uninstall Chef from the system Ruby installation\nif you tell it to:\n\n```\noverride_attributes(\n :omnibus_updater => {\n :remove_chef_system_gem => true\n }\n)\n```\n---\n\nIf you are using a Chef version earlier than 10.12.0 you may want\nto take a look at the chef_gem cookbook to ensure gems are going\nwhere expected.\n\n---\n\nThe default recipe will install the omnibus package based\non system information but you can override that by using\nthe `install_via` attribute which accepts: deb, rpm or script.\n\nFeatures\n========\n\nAuto version expansion\n----------------------\n\nVersions for the omnibus installer are defined as: x.y.z-n If the `:version` attribute only provides\nx.y.z the `n` value will be automatically filled in with the latest available version.\n\nAuto version searching\n----------------------\n\nUsing the `:version_search` attribute, the latest stable version of the omnibus installer will\nbe installed automatically as they become available.\n\nRelease clients\n---------------\n\nRelease clients can be installed via the auto-installation using `:allow_release_clients` attribute.\n\nDisable\n-------\n\nIf you want to disable the updater you can set the `disabled`\nattribute to true. This might be useful if the cookbook is added\nto a role but should then be skipped for example on a Chef server.\n\nInfos\n=====\n\n* Repo: https://github.com/hw-cookbooks/omnibus_updater\n* IRC: Freenode @ #heavywater\n\n",
|
||||
"maintainer": "Chris Roberts",
|
||||
"maintainer_email": "chrisroberts.code@gmail.com",
|
||||
"license": "Apache 2.0",
|
||||
"platforms": {
|
||||
},
|
||||
"dependencies": {
|
||||
},
|
||||
"recommendations": {
|
||||
},
|
||||
"suggestions": {
|
||||
},
|
||||
"conflicting": {
|
||||
},
|
||||
"providing": {
|
||||
},
|
||||
"replacing": {
|
||||
},
|
||||
"attributes": {
|
||||
},
|
||||
"groupings": {
|
||||
},
|
||||
"recipes": {
|
||||
},
|
||||
"version": "0.1.2"
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
maintainer "Chris Roberts"
|
||||
maintainer_email "chrisroberts.code@gmail.com"
|
||||
license "Apache 2.0"
|
||||
description "Chef omnibus package updater and installer"
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version "0.1.2"
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
# NOTE: This recipe is here for others that just want the
|
||||
# package, not the actual installation (lxc for example)
|
||||
|
||||
include_recipe 'omnibus_updater::set_remote_path'
|
||||
|
||||
remote_file "chef omnibus_package_downloader[#{File.basename(node[:omnibus_updater][:full_uri])}]" do
|
||||
path File.join(node[:omnibus_updater][:cache_dir], File.basename(node[:omnibus_updater][:full_uri]))
|
||||
source node[:omnibus_updater][:full_uri]
|
||||
backup false
|
||||
only_if do
|
||||
node[:omnibus_updater][:cache_omnibus_installer] &&
|
||||
!File.exists?(
|
||||
File.join(node[:omnibus_updater][:cache_dir], File.basename(node[:omnibus_updater][:full_uri]))
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
include_recipe 'omnibus_updater::old_package_cleaner'
|
|
@ -0,0 +1,30 @@
|
|||
include_recipe 'omnibus_updater::set_remote_path'
|
||||
|
||||
remote_file "chef omnibus_package[#{File.basename(node[:omnibus_updater][:full_uri])}]" do
|
||||
path File.join(node[:omnibus_updater][:cache_dir], File.basename(node[:omnibus_updater][:full_uri]))
|
||||
source node[:omnibus_updater][:full_uri]
|
||||
backup false
|
||||
not_if do
|
||||
File.exists?(
|
||||
File.join(node[:omnibus_updater][:cache_dir], File.basename(node[:omnibus_updater][:full_uri]))
|
||||
) || (
|
||||
Chef::VERSION.to_s.scan(/\d+\.\d+\.\d+/) == node[:omnibus_updater][:full_version].scan(/\d+\.\d+\.\d+/) && OmnibusChecker.is_omnibus?
|
||||
)
|
||||
end
|
||||
notifies :create, 'ruby_block[Omnibus Chef install notifier]', :delayed
|
||||
end
|
||||
|
||||
ruby_block 'Omnibus Chef install notifier' do
|
||||
block do
|
||||
true
|
||||
end
|
||||
action :nothing
|
||||
notifies :run, "execute[chef omnibus_install[#{node[:omnibus_updater][:full_version]}]]", :delayed
|
||||
end
|
||||
|
||||
execute "chef omnibus_install[#{node[:omnibus_updater][:full_version]}]" do
|
||||
command "dpkg -i #{File.join(node[:omnibus_updater][:cache_dir], File.basename(node[:omnibus_updater][:full_uri]))}"
|
||||
action :nothing
|
||||
end
|
||||
|
||||
include_recipe 'omnibus_updater::old_package_cleaner'
|
|
@ -0,0 +1,25 @@
|
|||
if node[:omnibus_updater][:disabled]
|
||||
Chef::Log.warn 'Omnibus updater disabled via `disabled` attribute'
|
||||
elsif node[:omnibus_updater][:install_via]
|
||||
case node[:omnibus_updater][:install_via]
|
||||
when 'deb'
|
||||
include_recipe 'omnibus_updater::deb_package'
|
||||
when 'rpm'
|
||||
include_recipe 'omnibus_updater::rpm_package'
|
||||
when 'script'
|
||||
include_recipe 'omnibus_updater::script'
|
||||
else
|
||||
raise "Unknown omnibus update method requested: #{node[:omnibus_updater][:install_via]}"
|
||||
end
|
||||
else
|
||||
case node.platform_family
|
||||
when 'debian'
|
||||
include_recipe 'omnibus_updater::deb_package'
|
||||
when 'fedora', 'rhel'
|
||||
include_recipe 'omnibus_updater::rpm_package'
|
||||
else
|
||||
include_recipe 'omnibus_updater::script'
|
||||
end
|
||||
end
|
||||
|
||||
include_recipe 'omnibus_updater::remove_chef_system_gem' if node[:omnibus_updater][:remove_chef_system_gem]
|
|
@ -0,0 +1,14 @@
|
|||
old_pkgs =
|
||||
if(::File.exist?(node[:omnibus_updater][:cache_dir]))
|
||||
Dir.glob(File.join(node[:omnibus_updater][:cache_dir], 'chef*')).find_all do |file|
|
||||
!file.include?(node[:omnibus_updater][:version]) && !file.scan(/\.(rpm|deb)$/).empty?
|
||||
end
|
||||
else
|
||||
[]
|
||||
end
|
||||
|
||||
old_pkgs.each do |filename|
|
||||
file filename do
|
||||
action :delete
|
||||
end
|
||||
end
|
|
@ -0,0 +1,10 @@
|
|||
gem_package 'chef' do
|
||||
action :purge
|
||||
only_if do
|
||||
Chef::Provider::Package::Rubygems.new(
|
||||
Chef::Resource::GemPackage.new('dummy_package')
|
||||
).gem_env.gem_paths.detect{|path|
|
||||
path.start_with?('/opt/omnibus') || path.start_with?('/opt/chef')
|
||||
}.nil? && node[:omnibus_updater][:remove_chef_system_gem]
|
||||
end
|
||||
end
|
|
@ -0,0 +1,30 @@
|
|||
include_recipe 'omnibus_updater::set_remote_path'
|
||||
|
||||
remote_file "chef omnibus_package[#{File.basename(node[:omnibus_updater][:full_uri])}]" do
|
||||
path File.join(node[:omnibus_updater][:cache_dir], File.basename(node[:omnibus_updater][:full_uri]))
|
||||
source node[:omnibus_updater][:full_uri]
|
||||
backup false
|
||||
not_if do
|
||||
File.exists?(
|
||||
File.join(node[:omnibus_updater][:cache_dir], File.basename(node[:omnibus_updater][:full_uri]))
|
||||
) || (
|
||||
Chef::VERSION.to_s.scan(/\d+\.\d+\.\d+/) == node[:omnibus_updater][:full_version].scan(/\d+\.\d+\.\d+/) && OmnibusChecker.is_omnibus?
|
||||
)
|
||||
end
|
||||
notifies :create, 'ruby_block[Omnibus Chef install notifier]', :delayed
|
||||
end
|
||||
|
||||
ruby_block 'Omnibus Chef install notifier' do
|
||||
block do
|
||||
true
|
||||
end
|
||||
action :nothing
|
||||
notifies :run, "execute[chef omnibus_install[#{node[:omnibus_updater][:full_version]}]]", :delayed
|
||||
end
|
||||
|
||||
execute "chef omnibus_install[#{node[:omnibus_updater][:full_version]}]" do
|
||||
command "rpm -Uvh #{File.join(node[:omnibus_updater][:cache_dir], File.basename(node[:omnibus_updater][:full_uri]))}"
|
||||
action :nothing
|
||||
end
|
||||
|
||||
include_recipe 'omnibus_updater::old_package_cleaner'
|
|
@ -0,0 +1,38 @@
|
|||
include_recipe 'omnibus_updater::set_remote_path'
|
||||
|
||||
remote_file "chef omnibus_script[#{File.basename(node[:omnibus_updater][:full_uri])}]" do
|
||||
path File.join(node[:omnibus_updater][:cache_dir], File.basename(node[:omnibus_updater][:full_uri]))
|
||||
source node[:omnibus_updater][:full_uri]
|
||||
backup false
|
||||
not_if do
|
||||
File.exists?(
|
||||
File.join(node[:omnibus_updater][:cache_dir], File.basename(node[:omnibus_updater][:full_uri]))
|
||||
) || (
|
||||
Chef::VERSION.to_s.scan(/\d+\.\d+\.\d+/) == node[:omnibus_updater][:full_version].scan(/\d+\.\d+\.\d+/) && OmnibusChecker.is_omnibus?
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
# NOTE: We do not use notifications to trigger the install
|
||||
# since they are broken with remote_file in 0.10.10
|
||||
execute "chef omnibus_install[#{node[:omnibus_updater][:full_version]}]" do
|
||||
command "bash #{File.join(node[:omnibus_updater][:cache_dir], File.basename(node[:omnibus_updater][:full_uri]))}"
|
||||
only_if do
|
||||
(File.exists?(
|
||||
File.join(node[:omnibus_updater][:cache_dir], File.basename(node[:omnibus_updater][:full_uri]))
|
||||
) &&
|
||||
Chef::VERSION.to_s.scan(/\d+\.\d+\.\d+/) != node[:omnibus_updater][:full_version].scan(/\d+\.\d+\.\d+/)) ||
|
||||
!OmnibusChecker.is_omnibus?
|
||||
end
|
||||
end
|
||||
|
||||
ruby_block "omnibus_updater[remove old install scripts]" do
|
||||
block do
|
||||
Dir.glob(File.join(node[:omnibus_updater][:cache_dir], 'chef*.sh')).each do |file|
|
||||
unless(file.include?(node[:omnibus_updater][:version]))
|
||||
Chef::Log.info "Deleting stale omnibus script: #{file}"
|
||||
File.delete(file)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,139 @@
|
|||
# RULES
|
||||
|
||||
if(node[:omnibus_updater][:version].nil? && !node[:omnibus_updater][:version_search])
|
||||
raise "Omnibus Updater cannot determine version installation request. Please set version of enable version search"
|
||||
end
|
||||
|
||||
if(node[:omnibus_updater][:version_search])
|
||||
Chef::Log.warn "Omnibus Updater is set to automatically upgrade via search!"
|
||||
if(node[:omnibus_updater][:allow_release_clients])
|
||||
Chef::Log.warn "Omnibus Updater will allow installation of release clients found via search!"
|
||||
end
|
||||
end
|
||||
|
||||
if(!node[:omnibus_updater][:version].to_s.include?('-') || node[:omnibus_updater][:version_search])
|
||||
require 'open-uri'
|
||||
require 'rexml/document'
|
||||
pkgs_doc = REXML::Document.new(open(node[:omnibus_updater][:base_uri]))
|
||||
pkgs_avail = pkgs_doc.elements.to_a('//Contents//Key').map(&:text).find_all do |f|
|
||||
(f.include?('.rpm') || f.include?('.deb')) && f.include?('chef') &&
|
||||
!f.include?('server') && (node[:omnibus_updater][:allow_release_clients] || !f.include?('.rc')) &&
|
||||
!f.scan(/\d+\.\d+\.\d+-\d+\./).empty?
|
||||
end
|
||||
unless(node[:omnibus_updater][:version_search])
|
||||
searched_ver = pkgs_avail.find_all{|x| x.include?(node[:omnibus_updater][:version]) }.sort.last
|
||||
unless(searched_ver)
|
||||
raise "Omnibus Updater failed to find a valid version string. Base version requested: #{node[:omnibus_updater][:version]}"
|
||||
else
|
||||
node.set[:omnibus_updater][:full_version] = searched_ver.scan(/\d+\.\d+\.\d+-\d+/).first
|
||||
node.set[:omnibus_updater][:version] = node[:omnibus_updater][:full_version].sub(/-\d+$/,'')
|
||||
end
|
||||
end
|
||||
else
|
||||
node.set[:omnibus_updater][:full_version] = node[:omnibus_updater][:version]
|
||||
end
|
||||
|
||||
platform_name = node.platform
|
||||
platform_majorversion = ""
|
||||
kernel_name = node.kernel.machine
|
||||
case node.platform_family
|
||||
when 'debian'
|
||||
if(node.platform == 'ubuntu')
|
||||
platform_version = case node.platform_version
|
||||
when '10.10', '10.04'
|
||||
platform_majorversion << '10.04'
|
||||
'10.04'
|
||||
when '12.10', '12.04', '11.10', '11.04'
|
||||
platform_majorversion << '11.04'
|
||||
'11.04'
|
||||
else
|
||||
raise 'Unsupported ubuntu version for deb packaged omnibus'
|
||||
end
|
||||
else
|
||||
platform_version = case pv = node.platform_version.split('.').first
|
||||
when '6', '5'
|
||||
platform_majorversion << '6'
|
||||
'6.0.5'
|
||||
else
|
||||
platform_majorversion << pv
|
||||
pv
|
||||
end
|
||||
end
|
||||
when 'fedora', 'rhel'
|
||||
platform_version = node.platform_version.split('.').first
|
||||
platform_name = 'el'
|
||||
platform_majorversion << platform_version
|
||||
else
|
||||
platform_version = node.platform_version
|
||||
end
|
||||
|
||||
if(node[:omnibus_updater][:install_via])
|
||||
install_via = node[:omnibus_updater][:install_via]
|
||||
else
|
||||
install_via = case node.platform_family
|
||||
when 'debian'
|
||||
'deb'
|
||||
when 'fedora', 'rhel', 'centos'
|
||||
'rpm'
|
||||
else
|
||||
raise 'Unsupported omnibus install method requested'
|
||||
end
|
||||
end
|
||||
case install_via
|
||||
when 'deb'
|
||||
if(pkgs_avail)
|
||||
path_name = pkgs_avail.find_all{ |path|
|
||||
ver = node[:omnibus_updater][:version] || '.'
|
||||
path.include?('.deb') && path.include?(platform_name) &&
|
||||
path.include?(platform_version) && path.include?(node.kernel.machine) &&
|
||||
path.include?(ver)
|
||||
}.sort.last
|
||||
else
|
||||
kernel_name = ""
|
||||
file_name = "chef_#{node[:omnibus_updater][:full_version]}.#{platform_name}.#{platform_version}_"
|
||||
if(node.kernel.machine.include?('64'))
|
||||
file_name << 'amd64'
|
||||
kernel_name << 'x86_64'
|
||||
else
|
||||
file_name << 'i386'
|
||||
kernel_name << 'i686'
|
||||
end
|
||||
file_name << '.deb'
|
||||
end
|
||||
when 'rpm'
|
||||
if(pkgs_avail)
|
||||
path_name = pkgs_avail.find_all{ |path|
|
||||
ver = node[:omnibus_updater][:version] || '.'
|
||||
path.include?('.rpm') && path.include?(platform_name) &&
|
||||
path.include?(platform_version) && path.include?(node.kernel.machine) &&
|
||||
path.include?(ver)
|
||||
}.sort.last
|
||||
else
|
||||
file_name = "chef-#{node[:omnibus_updater][:full_version]}.#{platform_name}#{platform_version}.#{node.kernel.machine}.rpm"
|
||||
end
|
||||
else
|
||||
raise 'Unsupported install via provided'
|
||||
end
|
||||
|
||||
remote_omnibus_file = if(path_name)
|
||||
File.join(node[:omnibus_updater][:base_uri], path_name)
|
||||
else
|
||||
File.join(
|
||||
node[:omnibus_updater][:base_uri],
|
||||
platform_name,
|
||||
platform_majorversion,
|
||||
kernel_name,
|
||||
file_name
|
||||
)
|
||||
end
|
||||
|
||||
unless(remote_omnibus_file == node[:omnibus_updater][:full_uri])
|
||||
node.override[:omnibus_updater][:full_uri] = remote_omnibus_file
|
||||
Chef::Log.info "Omnibus remote file location: #{remote_omnibus_file}"
|
||||
end
|
||||
|
||||
unless(node[:omnibus_updater][:full_version])
|
||||
node.set[:omnibus_updater][:version] = remote_omnibus_file.scan(%r{chef[_-](\d+.\d+.\d+-\d+)}).flatten.first
|
||||
node.set[:omnibus_updater][:full_version] = node[:omnibus_updater][:version]
|
||||
end
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
phantomjs CHANGELOG
|
||||
===================
|
||||
|
||||
v.0.0.6
|
||||
-------
|
||||
- Initial CHANGELOG created
|
|
@ -0,0 +1,27 @@
|
|||
phantomjs Cookbook
|
||||
==================
|
||||
[![Build Status](https://secure.travis-ci.org/customink-webops/phantomjs.png?branch=master)](http://travis-ci.org/customink-webops/phantomjs)
|
||||
|
||||
Installs the phantomjs cookbook and necessary packages. This repository also features a full test suite!
|
||||
|
||||
Attributes
|
||||
----------
|
||||
- `default['phantomjs']['version']` - the version number to install
|
||||
|
||||
Contributing
|
||||
------------
|
||||
1. Fork the project
|
||||
2. Create a feature branch (i.e. `add_feature_x`)
|
||||
3. Make your changes
|
||||
4. Write or change specs as necessary
|
||||
5. Ensure the specs pass:
|
||||
|
||||
$ bundle exec rspec
|
||||
|
||||
6. Submit a pull request on github
|
||||
|
||||
License and Authors
|
||||
-------------------
|
||||
Author: [Seth Vargo](https://github.com/sethvargo)
|
||||
|
||||
Copyright 2012, CustomInk, LLC
|
|
@ -0,0 +1,3 @@
|
|||
default['phantomjs'] = {
|
||||
'version' => '1.7.0'
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
"name": "phantomjs",
|
||||
"description": "Installs/Configures phantomjs",
|
||||
"long_description": "phantomjs Cookbook\n==================\n[![Build Status](https://secure.travis-ci.org/customink-webops/phantomjs.png?branch=master)](http://travis-ci.org/customink-webops/phantomjs)\n\nInstalls the phantomjs cookbook and necessary packages. This repository also features a full test suite!\n\nAttributes\n----------\n- `default['phantomjs']['version']` - the version number to install\n\nContributing\n------------\n1. Fork the project\n2. Create a feature branch (i.e. `add_feature_x`)\n3. Make your changes\n4. Write or change specs as necessary\n5. Ensure the specs pass:\n\n $ bundle exec rspec\n\n6. Submit a pull request on github\n\nLicense and Authors\n-------------------\nAuthor: [Seth Vargo](https://github.com/sethvargo)\n\nCopyright 2012, CustomInk, LLC\n",
|
||||
"maintainer": "CustomInk",
|
||||
"maintainer_email": "webops@customink.com",
|
||||
"license": "Apache 2.0",
|
||||
"platforms": {
|
||||
"amazon": ">= 0.0.0",
|
||||
"centos": ">= 0.0.0",
|
||||
"debian": ">= 0.0.0",
|
||||
"fedora": ">= 0.0.0",
|
||||
"oracle": ">= 0.0.0",
|
||||
"rhel": ">= 0.0.0",
|
||||
"scientific": ">= 0.0.0",
|
||||
"ubuntu": ">= 0.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
},
|
||||
"recommendations": {
|
||||
},
|
||||
"suggestions": {
|
||||
},
|
||||
"conflicting": {
|
||||
},
|
||||
"providing": {
|
||||
},
|
||||
"replacing": {
|
||||
},
|
||||
"attributes": {
|
||||
"version": {
|
||||
"display_name": "Version",
|
||||
"description": "The Version of phantomjs to install",
|
||||
"default": "1.7.0",
|
||||
"choice": [
|
||||
|
||||
],
|
||||
"calculated": false,
|
||||
"type": "string",
|
||||
"required": "optional",
|
||||
"recipes": [
|
||||
|
||||
]
|
||||
}
|
||||
},
|
||||
"groupings": {
|
||||
},
|
||||
"recipes": {
|
||||
"phantomjs::default": "Install phantomjs binary"
|
||||
},
|
||||
"version": "0.0.10"
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
name 'phantomjs'
|
||||
maintainer 'CustomInk'
|
||||
maintainer_email 'webops@customink.com'
|
||||
license 'Apache 2.0'
|
||||
description 'Installs/Configures phantomjs'
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version '0.0.10'
|
||||
|
||||
recipe 'phantomjs::default', 'Install phantomjs binary'
|
||||
|
||||
%w(amazon centos debian fedora oracle rhel scientific ubuntu).each do |os|
|
||||
supports os
|
||||
end
|
||||
|
||||
attribute 'version',
|
||||
:display_name => 'Version',
|
||||
:description => 'The Version of phantomjs to install',
|
||||
:default => '1.7.0'
|
|
@ -0,0 +1,52 @@
|
|||
#
|
||||
# Cookbook Name:: phantomjs
|
||||
# Recipe:: default
|
||||
#
|
||||
# Copyright 2012, CustomInk
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
# Packages
|
||||
case node['platform_family']
|
||||
when 'debian'
|
||||
%w(fontconfig libfreetype6).each do |package|
|
||||
package package
|
||||
end
|
||||
when 'fedora','rhel'
|
||||
%w(fontconfig freetype).each do |package|
|
||||
package package
|
||||
end
|
||||
end
|
||||
|
||||
basename = "phantomjs-#{node['phantomjs']['version']}-linux-#{node['kernel']['machine']}"
|
||||
|
||||
# Download the tarball
|
||||
remote_file "/usr/local/src/#{basename}.tar.bz2" do
|
||||
action :create_if_missing
|
||||
backup false
|
||||
mode '0644'
|
||||
checksum node['phantomjs']['checksum'] if node['phantomjs']['checksum']
|
||||
source "https://phantomjs.googlecode.com/files/#{basename}.tar.bz2"
|
||||
end
|
||||
|
||||
# Install phantomjs
|
||||
execute 'Install phantomjs' do
|
||||
command "tar -xvjf /usr/local/src/#{basename}.tar.bz2 -C /usr/local/"
|
||||
not_if "test -d /usr/local/#{basename}"
|
||||
end
|
||||
|
||||
# Set up the symbolic link
|
||||
link '/usr/local/bin/phantomjs' do
|
||||
to "/usr/local/#{basename}/bin/phantomjs"
|
||||
end
|
|
@ -0,0 +1,50 @@
|
|||
Description
|
||||
===========
|
||||
|
||||
Installs vim.
|
||||
|
||||
Requirements
|
||||
============
|
||||
|
||||
## Platform:
|
||||
|
||||
* Ubuntu/Debian
|
||||
* Red Hat/CentOS/Fedora/Scientific
|
||||
* ArchLinux
|
||||
|
||||
Attributes
|
||||
==========
|
||||
|
||||
* `node[:vim][:extra_packages]` - An array of extra packages related to vim to install (like plugins). Empty array by default.
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
Put `recipe[vim]` in a run list, or `include_recipe 'vim'` to ensure that vim is installed on your systems.
|
||||
|
||||
If you would like to install additional vim plugin packages, include their package names in the `node[:vim][:extra_packages]` attribute. Verify that your operating sytem has the package available.
|
||||
|
||||
Changes
|
||||
=======
|
||||
|
||||
## v1.0.2:
|
||||
|
||||
* Fixes COOK-598 (RHEL platforms support).
|
||||
|
||||
License and Author
|
||||
==================
|
||||
|
||||
Author:: Joshua Timberman <joshua@opscode.com>
|
||||
|
||||
Copyright 2010, Opscode, Inc
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
|
@ -0,0 +1,20 @@
|
|||
#
|
||||
# Cookbook Name:: vim
|
||||
# Attributes:: default
|
||||
#
|
||||
# Copyright 2010, Opscode, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
default[:vim][:extra_packages] = []
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"name": "vim",
|
||||
"description": "Installs vim and optional extra packages.",
|
||||
"long_description": "Description\n===========\n\nInstalls vim.\n\nRequirements\n============\n\n## Platform:\n\n* Ubuntu/Debian\n* Red Hat/CentOS/Fedora/Scientific\n* ArchLinux\n\nAttributes\n==========\n\n* `node[:vim][:extra_packages]` - An array of extra packages related to vim to install (like plugins). Empty array by default.\n\nUsage\n=====\n\nPut `recipe[vim]` in a run list, or `include_recipe 'vim'` to ensure that vim is installed on your systems.\n\nIf you would like to install additional vim plugin packages, include their package names in the `node[:vim][:extra_packages]` attribute. Verify that your operating sytem has the package available.\n\nChanges\n=======\n\n## v1.0.2:\n\n* Fixes COOK-598 (RHEL platforms support).\n\nLicense and Author\n==================\n\nAuthor:: Joshua Timberman <joshua@opscode.com>\n\nCopyright 2010, Opscode, Inc\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\n",
|
||||
"maintainer": "Opscode, Inc.",
|
||||
"maintainer_email": "cookbooks@opscode.com",
|
||||
"license": "Apache 2.0",
|
||||
"platforms": {
|
||||
"debian": ">= 0.0.0",
|
||||
"ubuntu": ">= 0.0.0",
|
||||
"arch": ">= 0.0.0",
|
||||
"redhat": ">= 0.0.0",
|
||||
"centos": ">= 0.0.0",
|
||||
"fedora": ">= 0.0.0",
|
||||
"scientific": ">= 0.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
},
|
||||
"recommendations": {
|
||||
},
|
||||
"suggestions": {
|
||||
},
|
||||
"conflicting": {
|
||||
},
|
||||
"providing": {
|
||||
},
|
||||
"replacing": {
|
||||
},
|
||||
"attributes": {
|
||||
},
|
||||
"groupings": {
|
||||
},
|
||||
"recipes": {
|
||||
},
|
||||
"version": "1.0.2"
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
maintainer "Opscode, Inc."
|
||||
maintainer_email "cookbooks@opscode.com"
|
||||
license "Apache 2.0"
|
||||
description "Installs vim and optional extra packages."
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version "1.0.2"
|
||||
|
||||
%w{debian ubuntu arch redhat centos fedora scientific}.each do |os|
|
||||
supports os
|
||||
end
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
#
|
||||
# Cookbook Name:: vim
|
||||
# Recipe:: default
|
||||
#
|
||||
# Copyright 2010, Opscode, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
# There is no vim package on RHEL/CentOS derivatives
|
||||
# * vim-minimal gives you /bin/vi
|
||||
# * vim-enhanced gives you /usr/bin/vim
|
||||
vim_base_pkgs = value_for_platform(
|
||||
["ubuntu", "debian", "arch"] => { "default" => ["vim"] },
|
||||
["redhat", "centos", "fedora", "scientific"] => { "default" => ["vim-minimal","vim-enhanced"] },
|
||||
"default" => ["vim"]
|
||||
)
|
||||
|
||||
vim_base_pkgs.each do |vim_base_pkg|
|
||||
package vim_base_pkg
|
||||
end
|
||||
|
||||
node[:vim][:extra_packages].each do |vimpkg|
|
||||
package vimpkg
|
||||
end
|
Loading…
Reference in New Issue