Ask Your Question

How to copy and install 3 different files from puppet master to 3 different locations , plz help

asked 2017-04-20 15:29:50 -0600

Adam gravatar image

updated 2017-04-24 14:42:28 -0600

I created a module to copy one file from the master and install to agents and it works fine with code below: but now I am trying to copy 3 different files in different directory and install each one on different set of nodes ( it is like a range of ips or dns names called A systems ...) For example: file A need to be installed on all agents in A systems File B need to be installed on all agents in B systems File C need to be installed on all agents in C Systems

  1 class profile::ma {
  3 file { '/tmp/':
  4     ensure  => 'present',
  5     replace => 'no',

  6     source  => 'puppet:///module/files/',
  7     mode   => '0755',
  8     notify  => Exec['install'],
 10 }
 12    exec { 'install':
 13      command     => '/tmp/ -i',
 14      onlyif      => '/usr/bin/test ! -e /etc/filetocheck',
  15 }
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-04-21 05:22:49 -0600

bschonecker gravatar image

updated 2017-04-21 10:17:39 -0600

source => "puppet:///module/filename-${environment}.sh",

Should do the trick on line #6 where you have,, in the module/files directory.

edit flag offensive delete link more



This is incorrect. You want source => "puppet:///module/filename-${environment}.sh", the files directory is overlooked by puppet even though your files are in the files directory. change module to your actual module name as well.

puser gravatar imagepuser ( 2017-04-21 06:26:18 -0600 )edit

Ah, yes. I didn't catch that. I was focused on using the ${environment} variable.

bschonecker gravatar imagebschonecker ( 2017-04-21 06:28:30 -0600 )edit

You can edit your answer, then if it works for the OP they can accept it

DarylW gravatar imageDarylW ( 2017-04-21 10:15:16 -0600 )edit

Thanks for your reply, but i should have said that I need to copy and install the file to 3 different set of agents not environment. I might nee to do lookup search or some sort like it.

Adam gravatar imageAdam ( 2017-04-24 14:40:32 -0600 )edit

So your concern is about managing different nodes/agents? Are you using the 'node' resource in site.pp? If so, you need to specifically pass the correct configuration to each node. This is usually done via the 'roles and profiles' pattern,

DarylW gravatar imageDarylW ( 2017-04-24 15:57:07 -0600 )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

1 follower


Asked: 2017-04-20 15:29:50 -0600

Seen: 149 times

Last updated: Apr 24 '17