1

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

Zama Ques
  • 523
  • 1
  • 9
  • 24

2 Answers2

4

Remove the quotation marks from the resource title, and the unnecessary path parameter:

file { $appdirs:
  ensure => directory,
  owner  => root,
  group  => root,
  mode   =>  0644,
}

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.

Dominic Cleal
  • 3,160
  • 19
  • 16
0

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.

Joe Niland
  • 457
  • 1
  • 5
  • 16