This message was deleted.
# puppet
s
This message was deleted.
r
https://www.puppet.com/docs/puppet/7/types/package.html#package-attribute-ensure with apt you should be able to set
ensure => purge,
which will remove the package and any deps that it pulled in that aren't in use by other packages.
c
Thanks
Is this still correct to use with apt?
node 'puppet.puppetlab.local' {
package { 'nginx':
ensure => 'purge',
}
}
This is what I get when I just try the
ensure => 'purge'
v
I think it's
purged
c
when installed:
if i do an
absent
it will just remove the bottom one, but not the rest
v
that's correct, it doesn't do any magic
your underlying package manager should handle removing leafs
c
but that is my question. How do i remove package and dependencies with puppet?
the package manager is
apt
and the
autoremove
would be the option....but how to call that with pupet?
v
Not an expert on apt. it even says on your screen it's not stable 🙂
Copy code
exec { "remove-leafes"
  command => "apt-get -y autoremove",
  refreshonly => true,
}
You can notify exec ?
c
the
stable
message is just be grepping from
apt list
that's it
I did try the
exec
method too, but had other issues. I'll try again in a min though.
r
purged will work, but it's picky about the deps. My guess is that
nginx
pull in
nginx-core
or some such and that package actually has the deps. purging
ngnix
by itself likely doesn't go deep enough.
Might be simpler to set autoremove, recommands and suggested packages to your liking in /etc/apt/ which should avoid needing to do anything other than set
ensure => absent,
when you remove a package.
should be able to set those policies using Puppet's apt module.
c
Thanks for your help...all. I posted in main channel what I did for now.