Hi, I''m looking for a way to have puppet kick off an upgrade of my companies software, but only when it''s somehow ''told'' to. In cfengine you can provide classes from the command line (such as upgrade_code) and then have parts of the policy only work if those classes are defined. Is there anyway to do something similar in puppet? At first I thought this was what tags were for, since they can be defined from the command line when running puppetd - but it looks like tagged resources are always ran, and that when tags are set they are the ONLY thing that is run, so that doesn''t quite work for what I''m trying to do. Thanks! -- 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.
Mohamed Lrhazi
2011-Feb-16 20:00 UTC
Re: [Puppet Users] execute resources only when told to
How about this: Create a module called "upgrade_my_software", then only "include" it when you want to, then "remove the include" when you''re done... On Wed, Feb 16, 2011 at 11:18 AM, loki77 <loki77@gmail.com> wrote:> Hi, I''m looking for a way to have puppet kick off an upgrade of my > companies software, but only when it''s somehow ''told'' to. In cfengine > you can provide classes from the command line (such as upgrade_code) > and then have parts of the policy only work if those classes are > defined. Is there anyway to do something similar in puppet? At first > I thought this was what tags were for, since they can be defined from > the command line when running puppetd - but it looks like tagged > resources are always ran, and that when tags are set they are the ONLY > thing that is run, so that doesn''t quite work for what I''m trying to > do. > > Thanks! > > -- > 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. > >-- 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.
The issue with that is that I have to change the policies on the puppetmaster each time I want to upgrade, and then make sure to remove the include after it runs on each host so that it doesn''t attempt the upgrade twice (which wouldn''t cause issues, but it leaves the window open for user error - ie: forgetting to remove the include). It was nice in cfengine to be able to alter the state of policy for just a single run by adding classes on the command line. If there''s no good way to do that with puppet, I guess I''ll have to write a shell script for it. I just wanted to keep the entirety of our config in puppet, and have more control over software releases. On Feb 16, 12:00 pm, Mohamed Lrhazi <lrh...@gmail.com> wrote:> How about this: > > Create a module called "upgrade_my_software", then only "include" it > when you want to, then "remove the include" when you''re done... > > > > > > > > On Wed, Feb 16, 2011 at 11:18 AM, loki77 <lok...@gmail.com> wrote: > > Hi, I''m looking for a way to have puppet kick off an upgrade of my > > companies software, but only when it''s somehow ''told'' to. In cfengine > > you can provide classes from the command line (such as upgrade_code) > > and then have parts of the policy only work if those classes are > > defined. Is there anyway to do something similar in puppet? At first > > I thought this was what tags were for, since they can be defined from > > the command line when running puppetd - but it looks like tagged > > resources are always ran, and that when tags are set they are the ONLY > > thing that is run, so that doesn''t quite work for what I''m trying to > > do. > > > Thanks! > > > -- > > 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 athttp://groups.google.com/group/puppet-users?hl=en.-- 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 Wed, Feb 16, 2011 at 8:18 AM, loki77 <loki77@gmail.com> wrote:> Hi, I''m looking for a way to have puppet kick off an upgrade of my > companies software, but only when it''s somehow ''told'' to. In cfengine > you can provide classes from the command line (such as upgrade_code) > and then have parts of the policy only work if those classes are > defined. Is there anyway to do something similar in puppet? At first > I thought this was what tags were for, since they can be defined from > the command line when running puppetd - but it looks like tagged > resources are always ran, and that when tags are set they are the ONLY > thing that is run, so that doesn''t quite work for what I''m trying to > do.You can use implicit tags, all resource in a class should be tagged by that class name. So if you have a class called foo, you should be able to use tag foo to apply them. If you want to perform this conditionally, you can also use environment variables to set custom facts and use those facts in your puppet manifests to include classes resource on the fly. FACTER_install_foo=true; export FACTER_install_foo FACTER_install_bar=true; export FACTER_install_bar Bacause "FACTER_" will be stripped off, in your puppet manifest: if $install_foo { include foo ... } Thanks, Nan -- 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 Wed, Feb 16, 2011 at 08:18:42AM -0800, loki77 wrote:> Hi, I''m looking for a way to have puppet kick off an upgrade of my > companies software, but only when it''s somehow ''told'' to.There''s this from the docs about Debian''s system upgrade path. Something like that? https://projects.puppetlabs.com/projects/1/wiki/Debian_Patterns#Problem -- ben -- 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.
Michael Barrett
2011-Feb-17 01:45 UTC
Re: [Puppet Users] execute resources only when told to
Cool - that would work. Thanks! On Feb 16, 2011, at 1:55 PM, Nan Liu wrote:> On Wed, Feb 16, 2011 at 8:18 AM, loki77 <loki77@gmail.com> wrote: >> Hi, I''m looking for a way to have puppet kick off an upgrade of my >> companies software, but only when it''s somehow ''told'' to. In cfengine >> you can provide classes from the command line (such as upgrade_code) >> and then have parts of the policy only work if those classes are >> defined. Is there anyway to do something similar in puppet? At first >> I thought this was what tags were for, since they can be defined from >> the command line when running puppetd - but it looks like tagged >> resources are always ran, and that when tags are set they are the ONLY >> thing that is run, so that doesn''t quite work for what I''m trying to >> do. > > You can use implicit tags, all resource in a class should be tagged by > that class name. So if you have a class called foo, you should be able > to use tag foo to apply them. > > If you want to perform this conditionally, you can also use > environment variables to set custom facts and use those facts in your > puppet manifests to include classes resource on the fly. > > FACTER_install_foo=true; export FACTER_install_foo > FACTER_install_bar=true; export FACTER_install_bar > > Bacause "FACTER_" will be stripped off, in your puppet manifest: > if $install_foo { > include foo > ... > } > > Thanks, > > Nan-- Michael Barrett loki77@gmail.com -- 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.
Michael Barrett
2011-Feb-17 01:46 UTC
Re: [Puppet Users] execute resources only when told to
Ahh, and this is perfect too. I could even include the current version in that file, which could then be read by whatever is installing the latest version. Thanks! On Feb 16, 2011, at 3:16 PM, Ben Hughes wrote:> On Wed, Feb 16, 2011 at 08:18:42AM -0800, loki77 wrote: > >> Hi, I''m looking for a way to have puppet kick off an upgrade of my >> companies software, but only when it''s somehow ''told'' to. > > There''s this from the docs about Debian''s system upgrade path. Something > like that? > https://projects.puppetlabs.com/projects/1/wiki/Debian_Patterns#Problem > > -- > ben > > -- > 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. >-- Michael Barrett loki77@gmail.com -- 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.