mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
76 lines
No EOL
2.3 KiB
JSON
76 lines
No EOL
2.3 KiB
JSON
{
|
|
"description": [
|
|
"This module will search a file for a line, and ensure that it is present or absent.",
|
|
"This is primarily useful when you want to change a single line in a file only. For other cases, see the M(copy) or M(template) modules."
|
|
],
|
|
"module": "lineinfile",
|
|
"examples": [
|
|
{
|
|
"code": "lineinfile dest=/etc/selinux/config regexp=^SELINUX= line=SELINUX=disabled"
|
|
},
|
|
{
|
|
"code": "lineinfile dest=/etc/sudoers state=absent regexp=\"^%wheel\""
|
|
}
|
|
],
|
|
"docuri": "lineinfile",
|
|
"author": "Daniel Hokka Zakrisson",
|
|
"filename": "library/lineinfile",
|
|
"version_added": "0.7",
|
|
"short_description": "Ensure a particular line is in a file",
|
|
"now_date": "2012-10-09",
|
|
"options": {
|
|
"insertafter": {
|
|
"default": "EOF",
|
|
"required": false,
|
|
"description": [
|
|
"Used with C(state=present). If specified, the line will be inserted after the specified regular expression. Two special values are available; C(BOF) for inserting the line at the beginning of the file, and C(EOF) for inserting the line at the end of the file."
|
|
],
|
|
"choices": [
|
|
"BOF",
|
|
"EOF"
|
|
]
|
|
},
|
|
"state": {
|
|
"default": "present",
|
|
"choices": [
|
|
"present",
|
|
"absent"
|
|
],
|
|
"required": false,
|
|
"description": [
|
|
"Whether the line should be there or not."
|
|
],
|
|
"aliases": []
|
|
},
|
|
"dest": {
|
|
"required": true,
|
|
"description": [
|
|
"The file to modify"
|
|
],
|
|
"aliases": [
|
|
"name",
|
|
"destfile"
|
|
]
|
|
},
|
|
"regexp": {
|
|
"required": true,
|
|
"description": [
|
|
"The regular expression to look for in the file. For C(state=present), the pattern to replace. For C(state=absent), the pattern of the line to remove."
|
|
]
|
|
},
|
|
"line": {
|
|
"required": false,
|
|
"description": [
|
|
"Required for C(state=present). The line to insert/replace into the file. Must match the value given to C(regexp)."
|
|
]
|
|
},
|
|
"backup": {
|
|
"default": false,
|
|
"required": false,
|
|
"description": [
|
|
"Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly."
|
|
]
|
|
}
|
|
},
|
|
"ansible_version": "0.8"
|
|
} |