Hi all, For some definition-based and custom resources, I''m looking for a way to tell systems: "only these should be present, the rest should be purged". 2 examples I can come up with are databases and webserver vhosts. Say I have configured a node to have 3 databases (a, b and c). Now I decide I don''t want c anymore. I end up putting ensure => absent for c. After a run, I can remove c alltogether. This feels like a odd thing to do. Ofcourse leaving c in (with absent) does no harm, but it will clutter the configs after some time. I would like to somehow configure some resource-types to remove/purge everything that does not get mentioned in the config. Then I can just take stuff out of configs if I don''t want it anymore. Has anyone found a solution for this? Thanks, Mathijs -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Daniel Pittman
2010-Jun-16 13:20 UTC
Re: [Puppet Users] "total control" for certain resources
Mathijs <bluescreen303@gmail.com> writes:> For some definition-based and custom resources, I''m looking for a way > to tell systems: "only these should be present, the rest should be > purged".Please don''t run this, but: # The puppet version of rm -rf /* Package { ensure => absent, noop => true } User { ensure => absent, noop => true } # These override the defaults package { "foo": ensure => present } Daniel -- ✣ Daniel Pittman ✉ daniel@rimspace.net ☎ +61 401 155 707 ♽ made with 100 percent post-consumer electrons -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
R.I.Pienaar
2010-Jun-16 13:25 UTC
Re: [Puppet Users] "total control" for certain resources
----- "Daniel Pittman" <daniel@rimspace.net> wrote:> Mathijs <bluescreen303@gmail.com> writes: > > > For some definition-based and custom resources, I''m looking for a > way > > to tell systems: "only these should be present, the rest should be > > purged". > > Please don''t run this, but: > > # The puppet version of rm -rf /* > Package { ensure => absent, noop => true } > User { ensure => absent, noop => true } > > # These override the defaults > package { "foo": ensure => present } >How does this meet his goals? He want to just remove things from the manifest and they must go away from the machines. Some providers supports purging and you can purge unmanaged resources using the resource type, but you really want to be careful with that. In other cases you can use the trick that''s in the FAQ of copying out an empty dir over a dir full of managed files, it will then purge unmanaged files in that dir. But there isn''t really a blanket answer to this request today. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Daniel Pittman
2010-Jun-17 03:58 UTC
Re: [Puppet Users] "total control" for certain resources
"R.I.Pienaar" <rip@devco.net> writes:> ----- "Daniel Pittman" <daniel@rimspace.net> wrote: > >> Mathijs <bluescreen303@gmail.com> writes: >> >> > For some definition-based and custom resources, I''m looking for a way to >> > tell systems: "only these should be present, the rest should be purged". >> >> Please don''t run this, but: >> >> # The puppet version of rm -rf /* >> Package { ensure => absent, noop => true } >> User { ensure => absent, noop => true } >> >> # These override the defaults >> package { "foo": ensure => present } > > How does this meet his goals? He want to just remove things from the manifest > and they must go away from the machines.Well, setting a default of ''ensure => absent'' tells the providers that when something isn''t listed in the manifest it should go away — which was my reading of the request. I suppose that Mathijs could be looking to have only things that were managed by puppet go away when removed...> Some providers supports purging and you can purge unmanaged resources using > the resource type, but you really want to be careful with that.Well, yes. You seem to be saying more or less the same thing I am, but disagreeing with me, and I don''t quite understand where. Daniel -- ✣ Daniel Pittman ✉ daniel@rimspace.net ☎ +61 401 155 707 ♽ made with 100 percent post-consumer electrons -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Thu, Jun 17, 2010 at 11:58 AM, Daniel Pittman <daniel@rimspace.net>wrote:> "R.I.Pienaar" <rip@devco.net> writes: > > ----- "Daniel Pittman" <daniel@rimspace.net> wrote: > > > >> Mathijs <bluescreen303@gmail.com> writes: > >> > > > Well, setting a default of ''ensure => absent'' tells the providers that when > something isn''t listed in the manifest it should go away — which was my > reading of the request. >that only works for defined packages! e.g. if you do package{"xyz":} then it will remove it by default, it will not remove the other packages. > Some providers supports purging and you can purge unmanaged resources> using > > the resource type, but you really want to be careful with that. > > Well, yes. You seem to be saying more or less the same thing I am, but > disagreeing with me, and I don''t quite understand where. >The resource purge removes things which are not defined in puppet, e.g. remove all hosts from /etc/hosts unless they are defined in puppet. Ohad -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Thanks for all answers, I indeed want unmanaged resources to remove themselves (in some cases, I know it''s somewhat dangerous). So the ensure => absent (in the package example) is not what I''m after, because that only works on managed resources. Packages that aren''t mentioned anywhere in the manifest are left alone. The "resource purge" being mentioned seems to be what I''m after. How does it work? How can I trigger it? Where to find docs and what resources have support for it? Thanks again Mathijs On Jun 17, 6:04 am, Ohad Levy <ohadl...@gmail.com> wrote:> On Thu, Jun 17, 2010 at 11:58 AM, Daniel Pittman <dan...@rimspace.net>wrote: > > > "R.I.Pienaar" <r...@devco.net> writes: > > > ----- "Daniel Pittman" <dan...@rimspace.net> wrote: > > > >> Mathijs <bluescreen...@gmail.com> writes: > > > Well, setting a default of ''ensure => absent'' tells the providers that when > > something isn''t listed in the manifest it should go away — which was my > > reading of the request. > > that only works for defined packages! e.g. if you do > package{"xyz":} > then it will remove it by default, it will not remove the other packages. > > > Some providers supports purging and you can purge unmanaged resources> using > > > the resource type, but you really want to be careful with that. > > > Well, yes. You seem to be saying more or less the same thing I am, but > > disagreeing with me, and I don''t quite understand where. > > The resource purge removes things which are not defined in puppet, e.g. > remove all hosts from /etc/hosts unless they are defined in puppet. > > Ohad-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
David Schmitt
2010-Jun-17 07:58 UTC
Re: [Puppet Users] Re: "total control" for certain resources
On 6/17/2010 8:15 AM, Mathijs wrote:> Thanks for all answers, > > I indeed want unmanaged resources to remove themselves (in some cases, > I know it''s somewhat dangerous). > So the ensure => absent (in the package example) is not what I''m > after, because that only works on managed resources. > Packages that aren''t mentioned anywhere in the manifest are left > alone. > > The "resource purge" being mentioned seems to be what I''m after. > How does it work? How can I trigger it? Where to find docs and what > resources have support for it?See the "resources" type in the type reference: resources { "package": purge => true } Best Regards, David -- dasz.at OG Tel: +43 (0)664 2602670 Web: http://dasz.at Klosterneuburg UID: ATU64260999 FB-Nr.: FN 309285 g FB-Gericht: LG Korneuburg -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
R.I.Pienaar
2010-Jun-17 08:04 UTC
Re: [Puppet Users] "total control" for certain resources
----- "Daniel Pittman" <daniel@rimspace.net> wrote:> >> > >> # The puppet version of rm -rf /* > >> Package { ensure => absent, noop => true } > >> User { ensure => absent, noop => true } > >> > >> # These override the defaults > >> package { "foo": ensure => present } > > > > How does this meet his goals? He want to just remove things from the > manifest > > and they must go away from the machines. > > Well, setting a default of ''ensure => absent'' tells the providers that > when something isn''t listed in the manifest it should go away — which was > my reading of the request.No, either I am misunderstanding you or you dont understand how the defaults work. --- Package { ensure => absent } package{"zsh": ensure => present} package{"foo": } --- Are you saying the hypothetical manifest would delete all packages except zsh? What it would do is remove package foo, install zsh, and do nothing else. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Daniel Pittman
2010-Jun-17 08:32 UTC
Re: [Puppet Users] "total control" for certain resources
"R.I.Pienaar" <rip@devco.net> writes:> ----- "Daniel Pittman" <daniel@rimspace.net> wrote: > >> >> >> >> # The puppet version of rm -rf /* >> >> Package { ensure => absent, noop => true } >> >> User { ensure => absent, noop => true } >> >> >> >> # These override the defaults >> >> package { "foo": ensure => present } >> > >> > How does this meet his goals? He want to just remove things from the >> manifest >> > and they must go away from the machines. >> >> Well, setting a default of ''ensure => absent'' tells the providers that >> when something isn''t listed in the manifest it should go away — which was >> my reading of the request. > > > No, either I am misunderstanding you or you dont understand how the defaults work.It looks like a little of both: apparently some of the providers don''t do discovery and act on everything, only what is explicitly named:> --- > Package { ensure => absent } > package{"zsh": ensure => present} > package{"foo": } > --- > > Are you saying the hypothetical manifest would delete all packages except > zsh?That was my understanding...> What it would do is remove package foo, install zsh, and do nothing else....and as far as I knew at least some of the other providers do behave that way. Sorry, though, it looks like mostly my screw-up. Daniel -- ✣ Daniel Pittman ✉ daniel@rimspace.net ☎ +61 401 155 707 ♽ made with 100 percent post-consumer electrons -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
R.I.Pienaar
2010-Jun-17 09:11 UTC
Re: [Puppet Users] "total control" for certain resources
----- "Daniel Pittman" <daniel@rimspace.net> wrote:> "R.I.Pienaar" <rip@devco.net> writes: > > ----- "Daniel Pittman" <daniel@rimspace.net> wrote: > > > >> >> > >> >> # The puppet version of rm -rf /* > >> >> Package { ensure => absent, noop => true } > >> >> User { ensure => absent, noop => true } > >> >> > >> >> # These override the defaults > >> >> package { "foo": ensure => present } > >> > > >> > How does this meet his goals? He want to just remove things from > the > >> manifest > >> > and they must go away from the machines. > >> > >> Well, setting a default of ''ensure => absent'' tells the providers > that > >> when something isn''t listed in the manifest it should go away — > which was > >> my reading of the request. > > > > > > No, either I am misunderstanding you or you dont understand how the > defaults work. > > It looks like a little of both: apparently some of the providers don''t > do discovery and act on everything, only what is explicitly named:some have a purge property yeah and you can do somting like: resource{"package": purge => true, noop => true} this will do what you wanted, though i am not 100% if that syntax is correct, but its done via that type. Will only work for types that do support purging, not many seem to do it. Like the ssh keys one would be *awesome* if they did.> > > --- > > Package { ensure => absent } > > package{"zsh": ensure => present} > > package{"foo": } > > --- > > > > Are you saying the hypothetical manifest would delete all packages > except > > zsh? > > That was my understanding... > > > What it would do is remove package foo, install zsh, and do nothing > else. > > ...and as far as I knew at least some of the other providers do behave > that > way. Sorry, though, it looks like mostly my screw-up. > > Daniel > -- > ✣ Daniel Pittman ✉ daniel@rimspace.net ☎ +61 401 > 155 707 > ♽ made with 100 percent post-consumer electrons > > -- > You received this message because you are subscribed to the Google > Groups "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en.-- R.I.Pienaar -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.