Class: Ansible::Ruby::Modules::Replace

Inherits:
Base show all
Includes:
Helpers::FileAttributes
Defined in:
lib/ansible/ruby/modules/generated/files/replace.rb,
lib/ansible/ruby/modules/custom/files/replace.rb

Overview

This module will replace all instances of a pattern within a file. It is up to the user to maintain idempotence by ensuring that the same pattern would never match any replacements made.

Instance Method Summary collapse

Methods included from Helpers::FileAttributes

included

Methods inherited from Base

#ansible_name, #to_h

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

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

Constructor Details

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

Instance Method Details

#afterString?

Returns If specified, the line after the replace/remove will start. Can be used in combination with C(before). Uses Python regular expressions; see U(docs.python.org/2/library/re.html).

Returns:

  • (String, nil)

    If specified, the line after the replace/remove will start. Can be used in combination with C(before). Uses Python regular expressions; see U(docs.python.org/2/library/re.html).



25
# File 'lib/ansible/ruby/modules/generated/files/replace.rb', line 25

attribute :after

#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.



33
# File 'lib/ansible/ruby/modules/generated/files/replace.rb', line 33

attribute :backup

#beforeString?

Returns If specified, the line before the replace/remove will occur. Can be used in combination with C(after). Uses Python regular expressions; see U(docs.python.org/2/library/re.html).

Returns:

  • (String, nil)

    If specified, the line before the replace/remove will occur. Can be used in combination with C(after). Uses Python regular expressions; see U(docs.python.org/2/library/re.html).



29
# File 'lib/ansible/ruby/modules/generated/files/replace.rb', line 29

attribute :before

#encodingString?

Returns The character encoding for reading and writing the file.

Returns:

  • (String, nil)

    The character encoding for reading and writing the file.



40
# File 'lib/ansible/ruby/modules/generated/files/replace.rb', line 40

attribute :encoding

#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.



37
# File 'lib/ansible/ruby/modules/generated/files/replace.rb', line 37

attribute :others

#pathString

Returns The file to modify.,Before 2.3 this option was only usable as I(dest), I(destfile) and I(name).

Returns:

  • (String)

    The file to modify.,Before 2.3 this option was only usable as I(dest), I(destfile) and I(name).



13
# File 'lib/ansible/ruby/modules/generated/files/replace.rb', line 13

attribute :path

#regexpString

Returns The regular expression to look for in the contents of the file. Uses Python regular expressions; see U(docs.python.org/2/library/re.html). Uses MULTILINE mode, which means C(^) and C($) match the beginning and end of the file, as well as the beginning and end respectively of I(each line) of the file.,Does not use DOTALL, which means the C(.) special character matches any character I(except newlines). A common mistake is to assume that a negated character set like C() will also not match newlines. In order to exclude newlines, they must be added to the set like C().,Note that, as of ansible 2, short form tasks should have any escape sequences backslash-escaped in order to prevent them being parsed as string literal escapes. See the examples.

Returns:

  • (String)

    The regular expression to look for in the contents of the file. Uses Python regular expressions; see U(docs.python.org/2/library/re.html). Uses MULTILINE mode, which means C(^) and C($) match the beginning and end of the file, as well as the beginning and end respectively of I(each line) of the file.,Does not use DOTALL, which means the C(.) special character matches any character I(except newlines). A common mistake is to assume that a negated character set like C() will also not match newlines. In order to exclude newlines, they must be added to the set like C().,Note that, as of ansible 2, short form tasks should have any escape sequences backslash-escaped in order to prevent them being parsed as string literal escapes. See the examples.



17
# File 'lib/ansible/ruby/modules/generated/files/replace.rb', line 17

attribute :regexp

#replaceString?

Returns The string to replace regexp matches. May contain backreferences that will get expanded with the regexp capture groups if the regexp matches. If not set, matches are removed entirely.

Returns:

  • (String, nil)

    The string to replace regexp matches. May contain backreferences that will get expanded with the regexp capture groups if the regexp matches. If not set, matches are removed entirely.



21
# File 'lib/ansible/ruby/modules/generated/files/replace.rb', line 21

attribute :replace