Created: 2014-05-18 15:03
Updated: 2014-05-18 15:04
License: gpl-2.0



Build Status

This is the file_content module to append/remove content of files to another file.

While file_line perfectly addresses managing lines within a file, it cannot handle parts of a file that go over a single line.

The concat module is another module, that can be used to build a file based on multiple snippets. However the concat module always manages the whole target file, and can not manage only subparts of a file.

This module addresses exactly these very few gaps of the other resource types, where they don't provide a sufficient solution.

It should really be seen as an alternative to concat and file_line if you want to manage multiple lines at once and still don't want to manage the complete file. So it is really only useful for a very tiny part of usecases.


  path    => '/tmp/testfile',
  content => "first line\second line",

You can also use another file as being the source for the content:

  path   => '/tmp/testfile',
  source => '/tmp/source_file',

You can also remove parts of that file:

  ensure  => 'absent',
  path    => '/tmp/testfile',
  content => "first line\second line",

Alternative implementation

This module ships with an alternative implementaiton that is being implemented by the file_content::manage define. This is a left-over of poc-ing the idea and should not be used. The native type is what you should go for. I left it for pure study and as a reference.


Please log tickets and issues on github

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more