Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I am completely new to Puppet and this is my first time writing code in puppet. I want to get a tar.gz file and then untar it to create the folder.

Here is my code:

file{ "${::filename}.tar.gz":
   ensure => 'file',
   mode   => '0644',
   notify => Exec['untar-file'],
exec{ 'download-file' :
   command => "wget URL_FOR_TAR_GZ",
   cwd     => "PATH_WHERE_TO_STORE",
   user    => "my_name",
   group   => "our company name",
exec { 'untar-file':
   command => "/bin/tar -xzvf tar_file_name",
   cwd     => "file_path",
   creates => "foldername_to_be_createdc",
   user    => "my_name",
   group   => "our company name",
   require => Exec['download-file']

As soon as I run this I get an error:

wget returned 8 instead of one of [0]" and "/Exec[download-file]/returns: change from notrun to 0 failed"

Where am I going wrong?

What happens when you execute the wget command on the node manually? Also, why are you creating the tarball with a file resource and then attempting to download it afterward with the exec? Furthermore, the file resource can download files for you: docs.puppet.com/puppet/latest/types/… – Matt Schuchard Jul 8, 2017 at 14:44 Status code 8 says something is wrong on the server Exit Status. Not sure the version of wget you are running so I took what Google offered up. – Ken Brittain Jul 8, 2017 at 14:47 @Matt: If I try to execute wget on command line I can download the file properly. Ken: does it mean I need to change wget version? – user3519456 Jul 8, 2017 at 14:50 @Matt: because otherwise I get and error asking to define path to the command saying "Validation failed". Also I am using http url to download the file so I cannot use source in file – user3519456 Jul 8, 2017 at 14:54 Ok then work on fixing the double resource and missing path to wget and see what happens afterward. – Matt Schuchard Jul 8, 2017 at 14:56

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.