1

How do I pass file name as arguments to puppet class? My manifest file is

class new_file ($my_filename){
    file { $my_filename:
        ensure => present,
        content => "I got it, Hello, I am Aura, with new content\n",
    }
}

node 'agent1' {
  class {new_file: path => "/tmp/t.txt", }
}
1

Your class accepts a parameter called my_filename:

class new_file ($my_filename){

But here you're supplying path:

class {new_file: path => "/tmp/t.txt", }

Change this parameter to the same name and it will prevent the invalid parameter path error:

class {new_file: my_filename => "/tmp/t.txt", }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.