-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4f00313
Showing
4 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
Package Installer | ||
============= | ||
|
||
Simple cookbook for managing package versions on a node. | ||
|
||
Usage | ||
===== | ||
|
||
Attributes | ||
---------- | ||
|
||
Define packages (and optionally version restrictions and action type) within the role: | ||
|
||
|
||
```ruby | ||
override_attributes( | ||
:package_installer => { | ||
:packages => { | ||
'vim' => nil, | ||
'mailutils' => { | ||
:version => '2.2' | ||
}, | ||
'emacs' => { | ||
:action => :upgrade | ||
} | ||
} | ||
} | ||
) | ||
``` | ||
|
||
By default the :upgrade action is used. If you want to keep the package | ||
pegged, simply specify a version or use the :install action. | ||
|
||
Issues/Bugs/Feature Requests | ||
---------------------------- | ||
|
||
Create a github issue or fork, fix and send me a pull request | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
default[:package_installer][:packages] = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
maintainer "Chris Roberts" | ||
maintainer_email "chrisroberts.code@gmail.com" | ||
license "Apache 2.0" | ||
description "Installs/Updates system packages" | ||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) | ||
version "0.0.1" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Iterate and install packages | ||
node[:package_installer][:packages].each do |pkg_name, pkg_info| | ||
if(pkg_info) | ||
pkg_action = pkg_info[:action] || :install | ||
pkg_version = pkg_info[:version] | ||
end | ||
package pkg_name do | ||
action pkg_action | ||
version pkg_version if pkg_version | ||
end | ||
end |