Jeeva,
I would make a custom fact (http://docs.puppetlabs.com/guides/custom_facts.html) that checks for the presence of these files. Your Puppet manifest would check the condition of this fact to ensure the file absent or present (i.e. if $custom_fact { file { '/path/to/file': ensure => file } } ).
Does that make sense?
Team,Any helpThanks,Jeeva
On Fri, Mar 30, 2012 at 12:51 PM, Munna S <19.m...@gmail.com> wrote:
Team,I need a puppet module to copy a file to different location based on condition check . Below is my requirementif /opt/path1 found on the server then copy file1if /opt/path2 found on the server then copy file1if /opt/path3 found on the server then copy file1if none of the above path found then dont copy file1Thanks,Jeeva
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
# /etc/puppet/modules/jb_test/manifests/jb_config.pp
class jb_test::jb_config {
$j_conf = 'group_test'
define jb_dir($dir) {
$jj_conf = "$jb_test::jb_config::j_conf"
exec { "lnk_${dir}":
path => [ '/bin', '/usr/bin' ],
command => "ln -s /opt/j_config/${jj_conf} /opt/${dir}/",
onlyif => "test -d /opt/${dir}",
}
}
}
# /etc/puppet/modules/jb_test/manifests/init.pp
class cp_jboss_conf {
include jb_test::jb_config
$cp_file = "$jb_test::jb_config::j_conf"
$conf_dir = '/opt/j_config'
#notify { "The file name is: ${cp_file}": }
# create directory recursively
exec { 'mkdir_jconf':
path => [ '/bin', '/usr/bin' ],
command => "mkdir -p ${conf_dir}",
unless => "test -d ${conf_dir}",
}
file {
"${cp_file}":
name => "${conf_dir}/${cp_file}", mode => '0644',
owner => 'root', group => 'root',
source => "puppet:///modules/jb_test/${cp_file}",
require => Exec[ 'mkdir_jconf' ];
}
jb_test::jb_config::jb_dir {
'copy_to_1st':
dir => 'jboss_1';
'copy_to_2nd':
dir => 'jboss_2';
'copy_to_3rd':
dir => 'jboss_3';
}
}
node 'vm-jeeva2' inherits jeeva_base {
include cp_jboss_conf
}
To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/_Puid9FxhfAJ.
node 'vm-jeeva2' {
include cp_jboss_conf
}
To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/n1-iTusITgQJ.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/EnPLOpwOS78J.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.