2012-10-03 04:46:49 +02:00
.TH ANSIBLE.LINEINFILE 5 "2012-10-02" "0.8" "ANSIBLE MODULES"
2012-09-26 20:41:44 +02:00
. " generated from library/lineinfile
.SH NAME
lineinfile \- Ensure a particular line is in a file
. " ------ DESCRIPTION
.SH DESCRIPTION
.PP
This module will search a file for a line, and ensure that it is present or absent.
.PP
This is primarily useful when you want to change a single line in a file only. For other cases, see the \fI copy\fR or \fI template\fR modules.
. " ------ OPTIONS
. "
. "
.SH OPTIONS
2012-10-01 03:10:07 +02:00
2012-09-26 20:41:44 +02:00
.IP state
2012-10-01 03:10:07 +02:00
Whether the line should be there or not.
2012-09-26 20:41:44 +02:00
.IR Choices :
2012-10-01 03:10:07 +02:00
present,absent. (default: present)
.IP name
The file to modify(required)
2012-09-26 20:41:44 +02:00
.IP insertafter
2012-10-03 04:46:49 +02:00
Used with \fC state=present\fR . If specified, the line will be inserted after the specified regular expression. Two special values are available; \fC BOF\fR for inserting the line at the beginning of the file, and \fC EOF\fR for inserting the line at the end of the file.
2012-09-26 20:41:44 +02:00
.IR Choices :
2012-10-01 03:10:07 +02:00
BOF,EOF. (default: EOF)
.IP regexp
2012-10-03 04:46:49 +02:00
The regular expression to look for in the file. For \fC state=present\fR , the pattern to replace. For \fC state=absent\fR , the pattern of the line to remove.(required)
2012-10-01 03:10:07 +02:00
.IP line
2012-10-03 04:46:49 +02:00
Required for \fC state=present\fR . The line to insert/replace into the file. Must match the value given to \fC regexp\fR .
2012-09-26 20:41:44 +02:00
.IP backup
2012-10-01 03:10:07 +02:00
Create a backup file including the timestamp information so you can get the original file back if you somehow clobbered it incorrectly.."
2012-09-26 20:41:44 +02:00
. "
. " ------ NOTES
. "
. "
. " ------ EXAMPLES
.SH EXAMPLES
.PP
.nf
lineinfile name=/etc/selinux/config regexp=^SELINUX= line=SELINUX=disabled
.fi
.PP
.nf
lineinfile name=/etc/sudoers state=absent regexp="^%wheel"
.fi
. " ------- AUTHOR
2012-10-03 04:46:49 +02:00
.SH AUTHOR
Daniel Hokka Zakrisson
2012-09-26 20:41:44 +02:00
.SH SEE ALSO
.IR ansible (1),
.I http://ansible.github.com/modules.html#lineinfile