Hey Guys, Thank you Peter and John for your continued input into this one. I absolutely agree with both of you about building our own packages and as I've been working with puppet and trying to configure these systems, it's become apparent that our own internal repository would be beneficial for a number of reasons.
With that said, I'm quite new to the 'nix world and I suspect building out packages/repository would take a little time and probably a few days of googl'in. So for the very immediate future, I'd like to get this working so I can get our initial puppet build going. packages/repository are definitely on my list tho. I'd like to quickly mention that the impetus behind this is that I'd like to run this against machines that we've built up without puppet and if possible, I'd like to refrain from things like the below manifest being run on a machine which already has boost installed, albeit manually without puppet. I changed the class to the following: class boost_install { # This will place the gzip locally in /tmp. File is pulled from puppet. file { "/tmp/boost_1_41_0.tar.bz2" : source => "puppet:///boost_install/boost_1_41_0.tar.bz2" , ensure => present , } # This will extract the boost gzip to the /tmp directory. exec { "untar_boost" : command => "tar -xjvf /tmp/boost_1_41_0.tar.bz2" , cwd => "/tmp/" , creates => "/tmp/boost_1_41_0" , path => ["/bin" , "/usr/sbin"] , require => File["/tmp/boost_1_41_0.tar.bz2"] , } # This will run the boost bootstrapper exec { "/tmp/boost_1_41_0/bootstrap.sh" : subscribe => Exec["untar_boost"] , } } >From the above code, I expect a few things to happen: 1. The exec "untar_boost" should only fire if "/tmp/boost_1_41_0.tar.bz2" is present 2. The exec "/tmp/boost_1_41_0/bootstrap.sh" should only fire if the untar boost occurs, which I believe is dependent upon the file being in that location. (I'm thinking this will work as a temporary dependency as I'm not sure how to make a dependency for the initial file being pulled down. In other words, I expect the file to be pulled down on every run which I guess is something I'll have to fix later). I'm thinking if I change from /tmp to something like /usr/src/puppet_pkgs then the files won't be deleted upon reboot and I can use them as a temporary placeholder until I figure out a more elegant solution to this hack that I've put together. I'm sorry for writing the novel above and I very much appreciate your help and support on this one. Cheers, Mike On Thursday, July 5, 2012 9:53:26 PM UTC-7, Mike Reed wrote: > > Hello all, > > I'm looking to run multiple commands via exec within a single class like > so: > > class boost_install { > # This will place the gzip locally in /tmp. File is pulled from > puppet. > file { "/tmp/boost_1_41_0.tar.bz2" : > source => "puppet:///boost_install/boost_1_41_0.tar.bz2" , > ensure => present , > } > > # This will extract the boost gzip to the /tmp directory. > # This will untar only if the /tmp/boost_1_41_0 directory does not > exist. > exec { "tar -xjvf /tmp/boost_1_41_0.tar.bz2" : > cwd => "/tmp/" , > creates => "/tmp/boost_1_41_0" , > path => ["/bin" , "/usr/sbin"] , > } > > # This will run the boost bootstrapper. bjam should be run after > this. > # This will only run if the ls command returns a 1. > # The unless will have to be redone because we have no way of > upgrading easily and this is sloppy. > exec { "/tmp/boost_1_41_0/bootstrap.sh" : > unless => 'ls /usr/local/include/boost' , > path => ["/bin/" , "/sbin/" , "/usr/bin/" , > "/usr/sbin/"] , > } > > # This will run the boost bjam modifier and should run only after > the bootstrap.sh has been run > # This will only run if the ls command returns a 1. > # This unless will have to be redone because we have no way of > upgrading easily and this is sloppy. > exec { "/tmp/boost_1_41_0/bjam cxxflags=-fPIC install" : > unless => 'ls /usr/local/include/boost' , > path => ["/bin/" , "/sbin/" , "/usr/bin/" , > "/usr/sbin/"] , > } > } > > However, after running the above class, I get the following: > > err: > /Stage[main]/Boost_install/Exec[/tmp/boost_1_41_0/bootstrap.sh]/returns: > change from notrun to 0 failed: /tmp/boost_1_41_0/bootstrap.sh returned 1 > instead of one of [0] at > /etc/puppet/modules/boost_install/manifests/init.pp:18 > err: /Stage[main]/Boost_install/Exec[/tmp/boost_1_41_0/bjam cxxflags=-fPIC > install]/returns: change from notrun to 0 failed: /tmp/boost_1_41_0/bjam > cxxflags=-fPIC install returned 1 instead of one of [0] at > /etc/puppet/modules/boost_install/manifests/init.pp:21 > notice: Finished catalog run in 1.31 seconds > > I was under the impression that I should be getting the "install returned > 1" output but it's usually silent and the command doesn't run. I'm > assuming that neither the bootstrap or bjam commands should run as the > /usr/local/include/boost directories exist on the machine and I'm expecting > the "ls" to return a 0; which it does on the machine because those > directories exist. > > I'm obviously missing something here and I'm looking for some direction. > > I do suspect that this can be done in a more elegant fashion especially > since the bjam command is dependent upon the bootstrap.sh script running > but I was hoping to at least get this working. > > Thanks in advance for the thoughts. > > Cheers, > > Mike > -- 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/-/v4ihkbKXW0IJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.