I am trying to create multiple directories using the following manifests
class app {
$dirs = app8
$appdirs = ['/data/tomcat/app8/conf', '/data/tomcat/app8/config', '/data/tomcat/app8/libs', '/data/tomcat/app8/deploy', '/data/tomcat /app8/webapps', '/data/tomcat/app8/temp', '/data/tomcat/app8/work']
file { "/data/tomcat/$dirs":
path => "/data/tomcat/$dirs",
ensure => directory,
owner => root,
group => root,
}
file { "$appdirs":
path => '$appdirs',
ensure => directory,
owner => root,
group => root,
mode => 0644,
}
}
But when I execute it is failing with the below error
# puppet agent --verbose --no-daemonize --onetime
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Caching catalog for node-003.wiley.com
Error: Failed to apply catalog: Parameter path failed on File[[/data/tomcat/app8/conf, /data/tomcat/app8/config, /data/tomcat/app8/libs, /data/tomcat/app8/deploy, /data/tomcat/app8/webapps, /data/tomcat/app8/temp, /data/tomcat/app8/work]]: File paths must be fully qualified, not '$appdirs' at /etc/puppetlabs/code/environments/production/manifests/classes/app.pp:15
Please suggest how to resolve the issue
Remove the quotation marks from the resource title, and the unnecessary
path
parameter:Using
"$appdirs"
creates a single string with the contents of the appdirs array in it, but you need to pass an array itself to declare multiple resources.Looks like you need to remove the quotes from around the appdirs variable and you don't need to explicitly specify path.
See this answer for an example.