lineinfile
Collection: builtin
Full Name: parallax.builtin.lineinfile
Aliases: ansible.builtin.lineinfile, lineinfile
Synopsis
Manage lineinfile
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| path | string | yes | The file to modify | |
| state | string | present | Whether the line should be present or absent | |
| line | string | The line to insert/replace | ||
| regexp | string | Regular expression to match lines | ||
| search_string | string | Literal string to match in lines | ||
| create | bool | false | Create file if it doesn’t exist | |
| backup | bool | false | Create backup of original file | |
| insertafter | string | Insert line after matching regex | ||
| insertbefore | string | Insert line before matching regex | ||
| firstmatch | bool | false | Use first regex match | |
| backrefs | bool | false | Use regex backreferences | |
| owner | string | File owner | ||
| group | string | File group | ||
| mode | string | File permissions | ||
| validate | string | Command to validate file before saving |
Example
- name: Example lineinfile task
lineinfile:
path: <your_path>