Ask Your Question
0

how to get a binary file read from master to agent on puppet enterprise

asked 2017-04-12 15:15:26 -0500

Adam gravatar image

I am trying to get the binary file on the agent from the master first then execute it : code below:

I have a binary file called install.sh on the master under /data/binary

on the agent when I run : puppet agent -t I get the following errro:

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Could not get metadata for puppet:///binaries/install.sh Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run

1  class profile: epo {
  2
  3   file { '/tmp/install.sh':
  4     ensure => 'file',
  5     source => 'puppet:///binaries/install.sh',
  6     notify => Exec['somthing'],
  7  }
  8    exec { 'something':
  9     command     => '/tmp/install.sh',
 10     refreshonly => true,
11  }
 12
 13  class { 'epo':
 14      class_enabled          => true,
 15      agent_install_type     => 'script',
 16      agent_install_options  => '-i',
 17      agent_service_name     => 'cma',
 18      agent_service_ensure   => 'running',
 19      agent_service_enable   => true,
 20      agent_service_provider => 'init',

 21      agent_service_script   => '/etc/init.d/cma',
 22    }
 23  }
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2017-04-13 09:38:40 -0500

puser gravatar image

updated 2017-04-14 06:31:37 -0500

file { '/tmp/install.sh': ensure => 'file', source => 'Puppet:///binaries/install.sh', notify => Exec['somthing'], }

Puppet needs to be capitalized. If that isn't the problem then make sure that <module_path>/files/binaries/install.sh is the correct path.

Try this:

source => 'Puppet:///modules/<your module="">/binaries/install.sh',

edit flag offensive delete link more

Comments

Thank you, but it's not it.

Adam gravatar imageAdam ( 2017-04-13 13:21:06 -0500 )edit

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Could not get metadata for puppet:///binaries/install.sh Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run means the path to the file is bad.

puser gravatar imagepuser ( 2017-04-14 06:21:20 -0500 )edit
0

answered 2017-04-13 01:49:34 -0500

greynolds gravatar image

Interesting ->>> Why not copy the executable to a path on the server(s) location then execute it?

From site.pp -> ensure the method of execution is defined for all || server path => '/usr/local/sbin:/usr/local/bin:/sbin:/bin:
In files directory within the module -> a full copy of the script (install.sh)

Define the source of the file from the module class reference puppet:///moduleName/install.sh

ensure your exec file contain the following parameter path => '/usr/local/sbin:/usr/local/bin:/sbin:/bin: onlyif => '/bin/grep -c /tmp /tmp/install.sh && exit 1 || exit 0', -> only execute if the file is not present {} if it returns a 1 do not run

This is one approach -> if you are using a Dashboard you can the script as a top level variable.

Hope this helps!

edit flag offensive delete link more

Comments

Thank you for replying , but I need to use the module from puppet forge and also need to get the file even not copied if exist.

Adam gravatar imageAdam ( 2017-04-13 13:22:51 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2017-04-12 14:51:51 -0500

Seen: 34 times

Last updated: Apr 14