I want to create multiple directories as well as in directories I want to create scripts with templates and want to insert different schema values for same scripts in placeholders in different folders. can anyone help me with this???
script.pp
class script {
$test_root = hiera('test_root')
$clientnames = hiera('clientnames')
$adcs = hiera('adcs')
$user = 'wild'
$usergroup = 'wild'
# function call with lambda:
$clientnames.each |String $clientid| {
#$adcs.sort.each |String $adc| {
file { "${test_root}/client/${clientid}/":
ensure => directory,
owner => "${user}",
group => "${usergroup}",
#mode => 0755,
}
file { "${test_root}/client/$clientid/scoring":
ensure => directory,
owner => "${user}",
group => "${usergroup}",
require => File["${aml_root}/client/$clientid"],
}
file { "${test_root}/client/$clientid/scoring/script.sh":
ensure => file,
#ensure => file,
#mode => 0755,
owner => "${user}",
group => "${usergroup}",
content => template('/etc/puppetlabs/code/environments/production/modules/wildron/templates/test.erb'),
require => File["${aml_root}/client/$clientid/scoring"],
}
}
}
template.pp
<% Array(@adcs).each do |line| -%>
#!/bin/ksh
# Client schema configuration
export AML_DB_CLIENT_SCHEMA=<%= line %>
<% end -%>
hiera
adcs:
- 'schema1'
- 'schema2'
clientnames:
- 'cid1'
- 'cid2'
output: its creating all folders and scripts.
But in scripts the output like same in all folders of clients
#!/bin/ksh
# Client schema configuration
export AML_DB_CLIENT_SCHEMA=schema1
#!/bin/ksh
# Client schema configuration
export AML_DB_CLIENT_SCHEMA=schema2
But i want like : if its cid1 folder i want the schema name as schema1 in script if its cid2 i want the schema name as schema 2 in script
Can any one help me out. Its urgent...!!!!!!