0 votes
in Ansible by

How can you use the Ansible module “lineinfile” to add a new line to a file?

a) By providing the contents of the file as a parameter to the module, along with the new line to add

b) By using a Jinja2 template to generate the contents of the file, including the new line

c) By using the “line” parameter to specify the new line to add, and the “path” parameter to specify the path to the file

d) By using the “regexp” parameter to specify the pattern to match, and the “line” parameter to specify the new line to add

1 Answer

0 votes
by
Solution: d) By using the “regexp” parameter to specify the pattern to match, and the “line” parameter to specify the new line to add

Explanation: The Ansible module “lineinfile” can be used to add a new line to a file by using the “regexp” parameter to specify the pattern to match and the “line” parameter to specify the new line to add.
...