Excellent, this is exactly what I was hoping for. Thanks. On Friday, March 3, 2017 at 10:30:42 AM UTC-7, Peter Kristolaitis wrote: > > A subscribed / notified resource will only trigger once. Puppet's basic > execution model only allows each resource to run once during a catalog run, > and you can think of notify/subscribe as a special case of using 'require' > to determine execution order. > > > On 3/3/2017 12:14 PM, Joshua Schaeffer wrote: > > Ahoy all, > > TL;DR > I'm looking for information on how a catalog runs, in particular if you > notify an exec resource within a manifest multiple times (from different > resources) will the exec run multiple times if it has refreshonly set to > true? I've given more details below: > > Background information > Right now I'm creating a series of modules that helps setup a server to > meet certain specifications after the server OS is installedt. It basically > comes down to a few general areas: > > 1. Create a module and sub-modules that installs basic components, > packages, networking, configuration, etc that is applicable to all > servers. > 2. Create a module and sub-modules that installs company and region > specifics. > 3. Create a module and sub-modules that installs specifics to the type > of server being setup and its purpose. > > I'm already done with steps 1 and 2 and working on getting items installed > and configured that are particular to the application level of the people > who will use the server (step 3). Unfortunately part of there steps are to > call a Perl script that sets up the system after the OS has been configured > and handed over to them. We don't have the time to really break out what > the Perl script is doing and "puppetize" each step, so we have decided to > just call the script itself in Puppet. Not the ideal way to run Puppet but > right now it is what we need to do. > > Situation > I have to pull the latest code from SVN as part of step 3 described above, > then copy a few of the files from the repo to another location. What I want > to do is if any files are copied over then notify an exec resource to run > the Perl script. So if the file that needs to be copied is not in the > destination directory, or the file that was pulled from SVN is > newer/changed then it will update the file in the destination directory. > This will then send a notify to the exec resource which will run the Perl > script. However, I only want to call the exec resource once. Say that three > files are going to be copied from the repo to the destination directory. If > only one of them is actually copied (because the other two are already > present and current) then the exec resource would only be notified once, > however if 2 or 3 of the files are actually copied then will the exec > resource be notified multiple times? If so will it run multiple times? > > This is the code I've created for it: > > # First checkout the packages. > vcsrepo { "/tmp/packages": > ensure => 'latest', > provider => 'svn', > source => $svn_path, > basic_auth_username => $svn_username, > basic_auth_password => get_password($svn_username, > lookup({name => > "${profile::site}::${environment}::dat::hostautomation::${svn_username}" > })), > } > > > # Copy individual files listed in the package map to use when > running the automation_software script. > svn_pkgs_map.each |$pkg, $pkg_detail| { > file { "${pkg_install_path}/${pkg_detail['name']}" > ensure => 'present', > source => > "file:///tmp/packages/${pkg_detail['name']}", > owner => 'ashl', > group => 'autoshel', > mode => '0644' > notify => Exec['automation-software'], > require => Vcsrepo['/tmp/packages'], > } > } > > > # Next install the packages. > exec { 'automation-software': > command => $cmd, > user => 'ashl', > refreshonly => true, > } > > > The first step just does a checkout on the repo, the second step copies > files listed in a map that are specified in Hiera. That step requires the > SVN step and then if the files are copied/updated will notify the exec > resource which will actually run the script which takes place in the third > step. > > Question > So my question is if I specify multiple files in my map and Puppet > actually copies multiple files, will it notify the exec resource multiple > times? If it does will it run the exec resource multiple times? > > Thanks, > Joshua > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to puppet-users...@googlegroups.com <javascript:>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/puppet-users/50aa738a-938f-445a-b52c-51a1a3533459%40googlegroups.com > > <https://groups.google.com/d/msgid/puppet-users/50aa738a-938f-445a-b52c-51a1a3533459%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > > >
-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/c542b72d-e38d-4cfe-8fed-12d7d182d381%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.