Knife::Pkg
A knife plugin to deal with package updates
This is a plugin for Chef's knife tool. It allows you to do package updates on your nodes with ease!
Examples
List all updates:
$ knife pkg show updates "*:*"
===> kpp1.example.com
libxml2 (2.7.8.dfsg-2+squeeze7)
postgresql-client-9.2 (9.2.4-2.pgdg60+1)
gpgv (1.4.10-4+squeeze2)
gnupg (1.4.10-4+squeeze2)
===> kpp2.example.com
libxml2 (2.7.8.dfsg-2+squeeze7)
postgresql-client-9.2 (9.2.4-2.pgdg60+1)
gpgv (1.4.10-4+squeeze2)
gnupg (1.4.10-4+squeeze2)
...
Install updates with user interaction:
$ knife pkg install updates "chef_environment:beta"
===> beta.example.com
The following updates are available:
libxml2 (2.7.8.dfsg-2+squeeze7)
libxml2-dev (2.7.8.dfsg-2+squeeze7)
Should I update all packages? [y|n]: n
Should I update libxml2 (2.7.8.dfsg-2+squeeze7)? [y|n]: y
libxml2 (2.7.8.dfsg-2+squeeze7) updated!
Should I update libxml2-dev (2.7.8.dfsg-2+squeeze7)? [y|n]: y
libxml2-dev (2.7.8.dfsg-2+squeeze7) updated!
===> beta.bar.de
The following updates are available:
libxml2 (2.7.8.dfsg-2+squeeze7)
libxml2-dev (2.7.8.dfsg-2+squeeze7)
Should I update all packages? [y|n]: y
Updating...
all packages updated!
...
Install defined updates without confirmation, ask for all others:
$ knife pkg install updates "roles:webserver" -U "libxml2,gpgv,gnupg"
===> s1.example.com
===> s2.example.com
===> s3.example.com
Updating libxml2 (2.7.8.dfsg-2+squeeze7)
Updating gpgv (1.4.10-4+squeeze2)
Updating gnupg (1.4.10-4+squeeze2)
===> s4.example.com
Updating libxml2 (2.7.8.dfsg-2+squeeze7)
The following updates are available:
libxml2-dev (2.7.8.dfsg-2+squeeze7)
Should I update all packages? [y|n]: y
Updating...
all packages updated!
===> s5.example.com
Updating libxml2 (2.7.8.dfsg-2+squeeze7)
Updating gpgv (1.4.10-4+squeeze2)
Updating gnupg (1.4.10-4+squeeze2)
===> s6.example.com
Updating libxml2 (2.7.8.dfsg-2+squeeze7)
===> staging.fuchstreff.de
===> postgres-staging.sauspiel.de
===> s7.example.com
Updating libxml2 (2.7.8.dfsg-2+squeeze7)
===> s8.example.com
Updating libxml2 (2.7.8.dfsg-2+squeeze7)
...
Requirements
- SSH access
- Chef(-Server) or anything else which supports
search(:node, "*:*")(not required when you use-m) - when
-moption is given,ohaihas to be installed on the node
Installation
Add this line to your application's Gemfile:
gem 'knife-pkg'
And then execute:
$ bundle
Or install it yourself as:
$ gem install knife-pkg
Supported Platforms
- Debian/Ubuntu
- look at example and send PRs
Overview
The plugin inherits from Knife::Ssh, so almost all options and configuration settings are supported.
The following sub-commands are provided:
knife pkg show updates SEARCH ()
knife pkg install updates SEARCH ()
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
License and Authors
Authors: Holger Amann [email protected]
Licensed under Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0
