Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am learning the puppet system and now need to do the next task. We have a few servers with same OS (Altlinux p6,t6) - puppet-agents and have a puppet-master.

On agents there are some packages installed, eg. 200 packages on first, 300 on second .... But we only need 180 installed. We know names of necessary packages but dont know names of other (unnecessary packages).

My question is: How can I check or install (if not installed yet) necessary packages and delete other packages (we dont know names of other installed packages)?

Help please

WBR Valentin

share|improve this question
So puppet cant standardize package list? – Valintinr Jun 9 '12 at 18:32

I have looked into this and come to the conclusion that while it is possible to do so by defining puppet modules with a Package{ ensure => absent } for the packages you want to pull there isn't a ready way to

As far as I'm aware there isn't a native method for bulk removing packages. I thought about scripting something using a foreach loop to pull the unwanted packages after reading a line delimited list from a config file.

In the end however I found the cleanest solution to build out new servers and use Puppet for all management from the get go. Your results may vary.

share|improve this answer
Yes, i know how to delete or install packages via puppet but i dont understand how to delete unnecessary packages. Once more repeat: we have installed on some agent eg.300 packages but necessary only eg.100 or 200 nothing metter now. We know only names of necessary packages. We dont know which other packages installed but they should be deleted. Can i do this via puppet. Thank for your reply – Valintinr Jun 7 '12 at 13:20

This should work:

resources { 'package':
    purge => true,

At first, I'd do this:

resources { 'package':
    purge => true,
    noop  => true,

And then check the logs to see what it would have done. Only when I got satisfied that it's working fine I'd remove the noop.

Anyway, what it does is tell Puppet to remove all resources of type package (as indicated by the name -- resource { 'user': purge => true } would remove users, for example) that are not being managed by Puppet. That is, if you have a line package { 'x': }, then that package won't be removed if installed. Any package without such a declaration will be removed.

share|improve this answer
Seems this variant shoud work. Ill check it later. Thank for help – Valintinr Jun 8 '12 at 6:55
@Valintinr I have now tested it, and it does work. – Daniel C. Sobral Jun 8 '12 at 15:08

Puppet can only do what you tell it to do no more than a person could do it for you without generating a list by some means. You need to tell Puppet which packages don't belong on the machine.

The simplest solution as Tim suggested is to reimage and build the machines correctly using Puppet.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.