- From: AJ Christensen <
>
- To:
- Subject: [chef] Re: Re: Re: Managing package preferences within chef (Debian, Ubuntu, RHEL, etc.)
- Date: Sat, 29 Sep 2012 12:03:53 +1200
Turns out Heavy Water has a cookbook for this too:
https://github.com/hw-cookbooks/package_installer
override_attributes(
:package_installer => {
:packages => {
'vim' => nil,
'mailutils' => {
:version => '2.2'
},
'emacs' => {
:action => :upgrade
}
}
}
)
Funny stuff.
Cheers,
AJ
On 29 September 2012 10:53, AJ Christensen
<
>
wrote:
>
Hello,
>
>
On 29 September 2012 10:26, Edward Morbius
>
<
>
>
wrote:
>
> I don't care about mechanism so much as I care about result.
>
>
Using the Recipe DSL you can map node data into resources. This is a
>
common Chef practice/procedure.
>
>
Try building up a hash of packages/states and consuming that with the
>
Recipe DSL, turning 'em into Package resources:
>
>
attributes:
>
>
default['package_installer']['packages'] = {
>
"htop" => :install,
>
"bmon" => :remove
>
}
>
>
recipe:
>
>
node['package_installer']['packages'].map |pkg_name, pkg_action|
>
package pkg_name do
>
action pkg_action unless pkg_action.nil?
>
end
>
end
>
>
Hope this helps; you should easily be able to add more packages/states
>
to a role, or event extend this example to use a data-bag -- usually
>
it is useful to care about the mechanism *and* the result!
>
>
Cheers,
>
>
AJ
>
>
>
>
> I'd like to specify a set of packages and the state in which they
>
> should exist on the system (including "not existing" as a state).
>
>
>
> I'd like to do this in as simple, intuitive, and maintainable manner
>
> as possible.
>
>
>
>
>
> On Fri, Sep 28, 2012 at 2:11 PM, Ranjib Dey
>
> <
>
>
> wrote:
>
>> do you mean an array of packages?
>
>> %w{ pkg1 pkg2 pkg3}.each do |pkg|
>
>> action :remove
>
>> end
>
>>
>
>>
>
>> On Sat, Sep 29, 2012 at 1:09 AM, Edward Morbius
>
>> <
>
>
>> wrote:
>
>>>
>
>>> We're looking for a lightweight way to specify package preferences
>
>>> (inclusion and exclusion) on chef-managed hosts.
>
>>>
>
>>> Ideally this would simply be a list of packages and desired
>
>>> installation states. Primary target is Ubuntu / Debian, so:
>
>>>
>
>>> <packagename> <install|remove|purge>
>
>>>
>
>>> ... would be the general form.
>
>>>
>
>>>
>
>>> I'm not seeing an obvious established way of doing this, but it seems
>
>>> like the sort of thing that should exist.
>
>>>
>
>>> What am I missing?
>
>>>
>
>>> --
>
>>> Dr. Ed Morbius
>
>>> Chief Scientist / Philologist / Robot Wrangler / Powerplant Operator
>
>>> Krell Power Systems Unlimited
>
>>
>
>>
>
>
>
>
>
>
>
> --
>
> Dr. Ed Morbius
>
> Chief Scientist / Philologist / Robot Wrangler / Powerplant Operator
>
> Krell Power Systems Unlimited
- [chef] Managing package preferences within chef (Debian, Ubuntu, RHEL, etc.), Edward Morbius, 09/28/2012
- [chef] Re: Managing package preferences within chef (Debian, Ubuntu, RHEL, etc.), Ranjib Dey, 09/28/2012
- [chef] Re: Re: Managing package preferences within chef (Debian, Ubuntu, RHEL, etc.), Edward Morbius, 09/28/2012
- [chef] Re: Re: Re: Managing package preferences within chef (Debian, Ubuntu, RHEL, etc.), AJ Christensen, 09/28/2012
- [chef] Re: Re: Re: Managing package preferences within chef (Debian, Ubuntu, RHEL, etc.), AJ Christensen, 09/28/2012
Archive powered by MHonArc 2.6.16.