lineinfile module

The module that makes sure one particular line is present in, or absent from, a text file.

In more detail

Unlike appending with >>, it checks the file first and adds the line only if it is missing, so running it twice leaves one copy. With create set to true it also creates the file. For whole files, prefer copy or template.

Related terms

Taught in

References

Certification courses