replace
Collection: builtin
Full Name: parallax.builtin.replace
Aliases: ansible.builtin.replace, replace
Synopsis
Manage replace
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| path | string | yes | Path to the file to modify (alias: dest, destfile, name) | |
| regexp | string | yes | Regular expression pattern to search for | |
| replace | string | Replacement string (if omitted, matching lines are removed) | ||
| backup | bool | false | Create a backup file including timestamp information | |
| encoding | string | utf-8 | encoding used for reading and writing the file | |
| validate | string | validate the file using a command | ||
| multiline | bool | false | Enable multiline mode (^ and $ match line boundaries) | |
| dotall | bool | false | Enable dotall mode (. matches newlines) | |
| ignorecase | bool | false | Enable case-insensitive matching | |
| before | string | If specified, only content before this pattern will be replaced | ||
| after | string | If specified, only content after this pattern will be replaced | ||
| others | string | ignore | ignore, warn, or fail | |
| owner | string | Name of the user that should own the file | ||
| group | string | Name of the group that should own the file | ||
| mode | string | The permissions the resulting file should have | ||
| attributes | string | The attributes the resulting file should have | ||
| seuser | string | The user part of the SELinux file context | ||
| serole | string | The role part of the SELinux file context | ||
| setype | string | The type part of the SELinux file context | ||
| selevel | string | The level part of the SELinux file context | ||
| unsafe_writes | bool | false | Allow unsafe file operations | |
| dest | string | alias for path | ||
| destfile | string | alias for path | ||
| name | string | alias for path |
Example
- name: Example replace task
replace:
path: <your_path>
regexp: <your_regexp>