define tarballinstall ( $source = 'puppet://puppet/files/some.tar.gz', $tmpfile = '/tmp/some.tar.gz', $destination = '', $cleanup = true, $testfile = "" ) { exec { "canary file": command => '', creates => $testfile, user => "root", path => ["/bin", "/usr/bin", "/usr/sbin"], logoutput => true, } file {$tmpfile: alias => "tarball-file", owner => root, group => root, mode => 0644, subscribe => Exec['canary file'], source => $source, } exec { "extract tarball": command => "tar xzvf $tmpfile", user => "root", cwd => $destination, path => ["/bin", "/usr/bin", "/usr/sbin"], logoutpu => true, refreshonly => true, #creates => $testfile, subscribe => Exec['canary file'], require => Exec["canary file"], } if $cleanup { exec { "cleanup tarball": command => "rm $tmpfile", user => "root", path => ["/bin", "/usr/bin", "/usr/sbin"], logoutput => true, refreshonly => true, subscribe => Exec['extract tarball'], require => Exec["extract tarball"], } } }