Resource Type: fm_replace

Defined in:
lib/puppet/type/fm_replace.rb
Providers:
ruby

Overview

Replace one instance of /regex/ in a text file with data and remove all other instances. Note that this works like a line-by-line find and replace. If there is nothing to replace then no change will be made! (use file_line for that)

Properties

  • ensure (defaults to: present)

    Add or remove the requested lines from the file

    Supported values:
    • present
    • absent

Parameters

  • data

    Lines to add to the file - accepts string or array. If n present newlines will be inserted

  • flags

    Regexp flags

  • insert_at (defaults to: bottom)

    If insert_if_missing true and we need to do an insert, where should the data be inserted? options are top, bottom or line number

  • insert_if_missing (defaults to: false)

    If true, always ensure that data is added to file, even if this involves inserting a new line instead of replacing a match

  • match (defaults to: false)

    If specified, remove all instances of /match/, and insert one line data if ensure=>present

  • path

    The file to operate on - you can only prepend once to any given file