Class: Ansible::Ruby::Modules::Lineinfile

Inherits:
Base show all
Defined in:
lib/ansible/ruby/modules/generated/core/files/lineinfile.rb

Instance Method Summary collapse

Methods inherited from Base

#ansible_name, #to_h

Methods inherited from Ansible::Ruby::Models::Base

attr_option, attr_options, attribute, #initialize, #to_h, validates

Constructor Details

This class inherits a constructor from Ansible::Ruby::Models::Base

Instance Method Details

#backrefs:yes, ...

Returns Used with C(state=present). If set, line can contain backreferences (both positional and named) that will get populated if the C(regexp) matches. This flag changes the operation of the module slightly; C(insertbefore) and C(insertafter) will be ignored, and if the C(regexp) doesn’t match anywhere in the file, the file will be left unchanged. If the C(regexp) does match, the last matching line will be replaced by the expanded line parameter.

Returns:

  • (:yes, :no, nil)

    Used with C(state=present). If set, line can contain backreferences (both positional and named) that will get populated if the C(regexp) matches. This flag changes the operation of the module slightly; C(insertbefore) and C(insertafter) will be ignored, and if the C(regexp) doesn’t match anywhere in the file, the file will be left unchanged. If the C(regexp) does match, the last matching line will be replaced by the expanded line parameter.



26
# File 'lib/ansible/ruby/modules/generated/core/files/lineinfile.rb', line 26

attribute :backrefs

#backup:yes, ...

Returns Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly.

Returns:

  • (:yes, :no, nil)

    Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly.



42
# File 'lib/ansible/ruby/modules/generated/core/files/lineinfile.rb', line 42

attribute :backup

#create:yes, ...

Returns Used with C(state=present). If specified, the file will be created if it does not already exist. By default it will fail if the file is missing.

Returns:

  • (:yes, :no, nil)

    Used with C(state=present). If specified, the file will be created if it does not already exist. By default it will fail if the file is missing.



38
# File 'lib/ansible/ruby/modules/generated/core/files/lineinfile.rb', line 38

attribute :create

#destString

Returns The file to modify.

Returns:

  • (String)

    The file to modify.



10
# File 'lib/ansible/ruby/modules/generated/core/files/lineinfile.rb', line 10

attribute :dest

#insertafter:EOF, ...

Returns Used with C(state=present). If specified, the line will be inserted after the last match of specified regular expression. A special value is available; C(EOF) for inserting the line at the end of the file. If specified regular expression has no matches, EOF will be used instead. May not be used with C(backrefs).

Returns:

  • (:EOF, :"*regex*", nil)

    Used with C(state=present). If specified, the line will be inserted after the last match of specified regular expression. A special value is available; C(EOF) for inserting the line at the end of the file. If specified regular expression has no matches, EOF will be used instead. May not be used with C(backrefs).



30
# File 'lib/ansible/ruby/modules/generated/core/files/lineinfile.rb', line 30

attribute :insertafter

#insertbefore:BOF, ...

Returns Used with C(state=present). If specified, the line will be inserted before the last match of specified regular expression. A value is available; C(BOF) for inserting the line at the beginning of the file. If specified regular expression has no matches, the line will be inserted at the end of the file. May not be used with C(backrefs).

Returns:

  • (:BOF, :"*regex*", nil)

    Used with C(state=present). If specified, the line will be inserted before the last match of specified regular expression. A value is available; C(BOF) for inserting the line at the beginning of the file. If specified regular expression has no matches, the line will be inserted at the end of the file. May not be used with C(backrefs).



34
# File 'lib/ansible/ruby/modules/generated/core/files/lineinfile.rb', line 34

attribute :insertbefore

#lineString?

Returns Required for C(state=present). The line to insert/replace into the file. If C(backrefs) is set, may contain backreferences that will get expanded with the C(regexp) capture groups if the regexp matches.

Returns:

  • (String, nil)

    Required for C(state=present). The line to insert/replace into the file. If C(backrefs) is set, may contain backreferences that will get expanded with the C(regexp) capture groups if the regexp matches.



22
# File 'lib/ansible/ruby/modules/generated/core/files/lineinfile.rb', line 22

attribute :line

#othersObject?

Returns All arguments accepted by the M(file) module also work here.

Returns:

  • (Object, nil)

    All arguments accepted by the M(file) module also work here.



46
# File 'lib/ansible/ruby/modules/generated/core/files/lineinfile.rb', line 46

attribute :others

#regexpString?

Returns The regular expression to look for in every line of the file. For C(state=present), the pattern to replace if found; only the last line found will be replaced. For C(state=absent), the pattern of the line to remove. Uses Python regular expressions; see U(docs.python.org/2/library/re.html).

Returns:

  • (String, nil)

    The regular expression to look for in every line of the file. For C(state=present), the pattern to replace if found; only the last line found will be replaced. For C(state=absent), the pattern of the line to remove. Uses Python regular expressions; see U(docs.python.org/2/library/re.html).



14
# File 'lib/ansible/ruby/modules/generated/core/files/lineinfile.rb', line 14

attribute :regexp

#state:present, ...

Returns Whether the line should be there or not.

Returns:

  • (:present, :absent, nil)

    Whether the line should be there or not.



18
# File 'lib/ansible/ruby/modules/generated/core/files/lineinfile.rb', line 18

attribute :state