Hi, I need to use the output of a script to set the value of a variable. I understand the only way to do this is to use a custom Facter fact. However, this script will only run when (naturally) it''s been installed, which is something Puppet takes care of. Conf files, which I would very much like to be able to install as part of the same run depend on the variable being set. So, it seems I have myself a lovely little chicken and egg problem — any ideas? —Oliver -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/D9ctUZ0f6CQJ. 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 Fri, Jul 29, 2011 at 05:55:33AM -0700, Oliver Beattie wrote:> Hi, > > I need to use the output of a script to set the value of a variable. I > understand the only way to do this is to use a custom Facter fact. > > However, this script will only run when (naturally) it''s been installed, which > is something Puppet takes care of. Conf files, which I would very much like to > be able to install as part of the same run depend on the variable being set. > > So, it seems I have myself a lovely little chicken and egg problem any ideas?Hi, you need this only on puppetmaster and it would be run with a specified class. -- Dominik Zyla -- 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.
If you put your custom fact in a module and enable plugin sync it should be deployed and run before your manifest IIRC. On Jul 29, 2011 5:55 AM, "Oliver Beattie" <oliver@obeattie.com> wrote:> Hi, > > I need to use the output of a script to set the value of a variable. I > understand the only way to do this is to use a custom Facter fact. > > However, this script will only run when (naturally) it''s been installed, > which is something Puppet takes care of. Conf files, which I would verymuch> like to be able to install as part of the same run depend on the variable > being set. > > So, it seems I have myself a lovely little chicken and egg problem — any > ideas? > > —Oliver > > -- > You received this message because you are subscribed to the Google Groups"Puppet Users" group.> To view this discussion on the web visithttps://groups.google.com/d/msg/puppet-users/-/D9ctUZ0f6CQJ.> To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email topuppet-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 Fri, Jul 29, 2011 at 8:55 AM, Oliver Beattie <oliver@obeattie.com> wrote:> Hi, > I need to use the output of a script to set the value of a variable. I > understand the only way to do this is to use a custom Facter fact. > However, this script will only run when (naturally) it''s been installed, > which is something Puppet takes care of. Conf files, which I would very much > like to be able to install as part of the same run depend on the variable > being set. > So, it seems I have myself a lovely little chicken and egg problem — any > ideas?You can use pluginsync to load your custom script to the target system similar to custom facts types/providers. Just place your custom script in a modules lib directory and it will sync to the agent''s plugindest folder. The only issue at the moment is puppet will try and fail to load non-ruby files. notice: /File[/var/opt/lib/pe-puppet/lib/custom/sample.sh]/ensure: defined content as ''{md5}e2e5b99530dc61705e58b8fae70799ac'' info: Loading downloaded plugin /var/opt/lib/pe-puppet/lib/custom/sample.sh err: Could not load downloaded file /var/opt/lib/pe-puppet/lib/custom/sample.sh: undefined method `echo'' for main:Object We have an open ticket http://projects.puppetlabs.com/issues/4135 to resolve this issue. 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.
I need it to run at a specified point during the manifest though. The value of the fact depends on a package being installed. And my config files depend on the value of the fact. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/SBQVMrLfe6gJ. 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 Jul 29, 2011, at 6:25 AM, Oliver Beattie wrote:> I need it to run at a specified point during the manifest though. The value of the fact depends on a package being installed. And my config files depend on the value of the fact.---- Rather than just conceptualize it - assume it works as you want and implement the custom fact (and pluginsync on the clients) and see what happens. If it is still a problem, provide us with the specific problem and someone will be able to give you a specific solution. Perhaps the hardest thing to grasp about puppet is how to programmatically define subscribe/require/notify so that things happen in a sequence because it is a declarative language. What I have found that works for me is to have a ''default'' node setting that does only configure puppet (puppet.conf & install a sysv script for puppet because I am installing from gems) and force in a specific /etc/apt/sources.list file, add an apt ''key'' for an extra debian source, then do an apt-get update/upgrade and stop. At that point, I can define anything else I want for subsequent puppet agent runs and know that the custom ''facts'' have been derived and can succeed. Craig -- 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 Jul 29, 2011 9:25 AM, "Oliver Beattie" <oliver@obeattie.com> wrote:> > I need it to run at a specified point during the manifest though. Thevalue of the fact depends on a package being installed. And my config files depend on the value of the fact Will stages (pre, main, etc) help in this case? -- 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 Fact will get downloaded ahead of the manifest being compiled. You just need to add a require => Service[myservice] to the config file. John -- 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 Jul 29, 7:55 am, Oliver Beattie <oli...@obeattie.com> wrote:> Hi, > > I need to use the output of a script to set the value of a variable. I > understand the only way to do this is to use a custom Facter fact. > > However, this script will only run when (naturally) it''s been installed, > which is something Puppet takes care of. Conf files, which I would very much > like to be able to install as part of the same run depend on the variable > being set. > > So, it seems I have myself a lovely little chicken and egg problem — any > ideas?If you only need the script for this purpose then instead of writing a custom fact that reports the output of your script, convert your script into the custom fact. You have the full power of Ruby at your disposal. If that''s sufficient then it''s cleaner in multiple ways. It sounds like that may not be enough for you, however. If there are reasons other than script installation why you want the fact value to be computed somewhere in the middle of the run, then you have two options that I can see: 1) Accept that (at least) two Puppet runs will sometimes be required to move a client into its intended state. 2) Move the needed code from your existing script to one of the affected Package''s install scripts. Naturally, this requires rolling a custom version of that package. John -- 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 Jul 29, 11:17 am, Paul Morgan <jumanji...@gmail.com> wrote:> On Jul 29, 2011 9:25 AM, "Oliver Beattie" <oli...@obeattie.com> wrote: > > > I need it to run at a specified point during the manifest though. The > > value of the fact depends on a package being installed. And my config files > depend on the value of the fact > > Will stages (pre, main, etc) help in this case?No. Run stages are a mechanism for establishing resource relationships, and they do not induce additional fact computations. No matter how many stages are defined, the facts for a given run are always determined exactly once, after pluginsync (if that''s enabled) but before everything else. John -- 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.