Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Please edit your post and wrap your code in code blocks. It is very hard to read and understand.

Please edit Your template is looping over the $adcs array and creating a complete script with each loop. That's why your post and wrap your code in code blocks. It is very hard to read and understand.files look the way they do.

Try again with these changes:

class script {

  $test_root   = hiera('test_root')
  $clientnames = hiera('clientnames')
  $adcs        = hiera('adcs')
  $user        = 'wild'
  $usergroup   = 'wild'


  $clientnames.each |String $clientid| {
    $adcs.sort.each |String $adc| {

      file { "${test_root}/client/${clientid}/":
        ensure => directory,
        owner  => $user,
        group  => $usergroup,
      }

      file { "${test_root}/client/${clientid}/scoring":
        ensure => directory,
        owner  => $user,
        group  => $usergroup,
      }

      file { "${test_root}/client/${clientid}/scoring/script.sh":
        ensure  => file,
        owner   => $user,
        group   => $usergroup,
        content => template('wildron/test.erb'),
      }
    }
  }
}

script.erb

#!/bin/ksh
# Client schema configuration
export AML_DB_CLIENT_SCHEMA=<%= @adc %>