1

I am trying to add a line to an existing file /etc/fuse.conf. I tried this

added a folder two folders under modules directory

sudo mkdir /etc/puppet/modules/test
sudo mkdir /etc/puppet/modules/test/manifests

Then created a test.pp file and added following lines

sudo vim /etc/puppet/modules/test/manifests/test.pp

file { '/etc/fuse.conf':
  ensure => present,
}->
file_line { 'Append a line to /etc/fuse.conf':
  path => '/etc/fuse.conf',
  line => 'Want to add this line as a test',
}

After that I ran this command

puppet apply /etc/puppet/modules/test/manifests/test.pp

Then I opened this file /etc/fuse.conf and there was no change in the file. The line was not added to the file. I don't understand what I am missing here. How can I do this? I am learning puppet. So this is only for learning purpose.

1 Answers1

2

I'm not sure which version of puppet you are using, since you didn't mention it. The "file_name" class belongs to the puppetlabs-stdlib library, so you need to make sure that this module is installed -

puppet module install puppetlabs-stdlib

also, since you are using a module path, you need to call your file init.pp (not test.pp). Since you are new to writing modules, I suggest you use the puppet module generate command -

puppet module generate module-name --skip-interview

this will create all you'll need for a new module. don't forget to make sure that the class name is the same as the module's name. In order to run and test this module, use -

puppet apply  -e "include <module-name>"