Class: Ansible::Ruby::Modules::Lineinfile
- Inherits:
-
Base
- Object
- Ansible::Ruby::Models::Base
- Base
- Ansible::Ruby::Modules::Lineinfile
- Defined in:
- lib/ansible/ruby/modules/generated/files/lineinfile.rb,
lib/ansible/ruby/modules/custom/files/lineinfile.rb
Overview
This module ensures a particular line is in a file, or replace an existing line using a back-referenced regular expression. This is primarily useful when you want to change a single line in a file only. See the M(replace) module if you want to change multiple, similar lines or check M(blockinfile) if you want to insert/update/remove a block of lines in a file. For other cases, see the M(copy) or M(template) modules.
Instance Method Summary collapse
-
#backrefs ⇒ String?
Used with C(state=present).
-
#backup ⇒ String?
Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly.
-
#create ⇒ String?
Used with C(state=present).
-
#firstmatch ⇒ String?
Used with C(insertafter) or C(insertbefore).
-
#insertafter ⇒ :EOF, ...
Used with C(state=present).
-
#insertbefore ⇒ :BOF, ...
Used with C(state=present).
-
#line ⇒ String?
Required for C(state=present).
-
#others ⇒ Object?
All arguments accepted by the M(file) module also work here.
-
#path ⇒ String
The file to modify.,Before 2.3 this option was only usable as I(dest), I(destfile) and I(name).
-
#regexp ⇒ String?
The regular expression to look for in every line of the file.
-
#state ⇒ :absent, ...
Whether the line should be there or not.
Methods inherited from Base
Methods inherited from Ansible::Ruby::Models::Base
attr_option, attr_options, attribute, #initialize, remove_existing_validations, #to_h, validates
Constructor Details
This class inherits a constructor from Ansible::Ruby::Models::Base
Instance Method Details
#backrefs ⇒ String?
29 |
# File 'lib/ansible/ruby/modules/generated/files/lineinfile.rb', line 29 attribute :backrefs |
#backup ⇒ String?
45 |
# File 'lib/ansible/ruby/modules/generated/files/lineinfile.rb', line 45 attribute :backup |
#create ⇒ String?
41 |
# File 'lib/ansible/ruby/modules/generated/files/lineinfile.rb', line 41 attribute :create |
#firstmatch ⇒ String?
49 |
# File 'lib/ansible/ruby/modules/generated/files/lineinfile.rb', line 49 attribute :firstmatch |
#insertafter ⇒ :EOF, ...
33 |
# File 'lib/ansible/ruby/modules/generated/files/lineinfile.rb', line 33 attribute :insertafter |
#insertbefore ⇒ :BOF, ...
37 |
# File 'lib/ansible/ruby/modules/generated/files/lineinfile.rb', line 37 attribute :insertbefore |
#line ⇒ String?
25 |
# File 'lib/ansible/ruby/modules/generated/files/lineinfile.rb', line 25 attribute :line |
#others ⇒ Object?
53 |
# File 'lib/ansible/ruby/modules/generated/files/lineinfile.rb', line 53 attribute :others |
#path ⇒ String
13 |
# File 'lib/ansible/ruby/modules/generated/files/lineinfile.rb', line 13 attribute :path |
#regexp ⇒ String?
17 |
# File 'lib/ansible/ruby/modules/generated/files/lineinfile.rb', line 17 attribute :regexp |
#state ⇒ :absent, ...
21 |
# File 'lib/ansible/ruby/modules/generated/files/lineinfile.rb', line 21 attribute :state |