Resource Type: file_line_after

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

Overview

Ensures that a given line is contained within a file. The implementation matches the full line, including whitespace at the beginning and end. If the line is not contained in the given file, Puppet will add the line to ensure the desired state. Multiple resources may be declared to manage multiple lines in the same file.

Example:

file_line_after { 'sudo_rule':
  path => '/etc/sudoers',
  line => '%sudo ALL=(ALL) ALL',
}
file_line_after { 'sudo_rule_nopw':
  path => '/etc/sudoers',
  line => '%sudonopw ALL=(ALL) NOPASSWD: ALL',
}

In this example, Puppet will ensure both of the specified lines are contained in the file /etc/sudoers.

Properties

  • ensure (defaults to: present)

    The basic property that the resource should be in.

    Supported values:
    • present
    • absent

Parameters

  • after

    An optional value used to specify the line after which we will add any new lines. (Existing lines are added in place)

  • line

    The line to be appended to the file located by the path parameter.

  • match
  • multiple

    An optional value to determine if match can change multiple lines.

    Supported values:
    • true
    • false
  • name (namevar)

    An arbitrary name used as the identity of the resource.

  • path

    The file Puppet will ensure contains the line specified by the line parameter.

  • provider

    The specific backend to use for this ‘file_line_after` resource. You will seldom need to specify this — Puppet will usually discover the appropriate provider for your platform.