I take it you want to have one manifest that is agnostic to all environments and copy the right files? Your files have to be put into each environment respectively. When the manifest runs it will pull the file from that environment on the server.
- A goes in /etc/puppetlabs/code/environments/A/modules/your_module/files/filename.sh - B goes in /etc/puppetlabs/code/environments/B/modules/your_module/files/filename.sh - C goes in /etc/puppetlabs/code/environments/C/modules/your_module/files/filename.sh Your code remains the same, just make sure you call the right environment on your node. If you need to install the file into different locations based on the environment then you probably want to use either an if or case statement or use Hiera: case $environment { 'A': {$install_path = '/env/A/install/path'} 'B': {$install_path = '/env/B/install/path''} 'C': {$install_path = '/env/C/install/path'} default: {} } file { $install_path: ensure => 'present', replace => 'no', source => 'puppet:///module/files/filename.sh', mode => '0755', notify => Exec['install'], } And in Hiera: --- your_module::A::install_path: '/env/A/install/path' your_module::B::install_path: '/env/B/install/path' your_module::C::install_path: '/env/C/install/path' file { 'environment-file' path => lookup("your_module::${environment}::install_path", String) ... } Hope that helps. Thanks, Joshua Schaeffer On Thursday, April 20, 2017 at 2:51:50 PM UTC-6, mike....@gmail.com wrote: > > 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 environment. > For example: file A need to be installed on all agents in A environment > File B need to be installed on all agents in B environment File C need to > be installed on all agents in C environment > > 1 class profile::ma { > 2 > 3 file { '/tmp/filename.sh': > 4 ensure => 'present', > 5 replace => 'no', > > 6 source => 'puppet:///module/files/filename.sh', > 7 mode => '0755', > 8 notify => Exec['install'], > 9 > 10 } > 11 > 12 exec { 'install': > 13 command => '/tmp/filename.sh -i', > 14 onlyif => '/usr/bin/test ! -e /etc/filetocheck', > 15 }16} > > -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/6265c731-5db5-4a2c-b4a4-475ad7a8598c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.