Importance of lineinfile module in Ansible

0 votes

Hi Guys,

I am new to lineinfile module. I don't know how to use this module in Ansible Playbook. Can anyone tell me when to use this module?

Sep 2, 2020 in Ansible by akhtar
• 38,170 points
116 views

1 answer to this question.

0 votes

Hi@akhtar,

The lineinfile 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. See the replace module if you want to change multiple, similar lines or check blockinfile if you want to insert/update/remove a block of lines in a file. For other cases, see the copy or template modules. You can also go through the below document for more information.

https://docs.ansible.com/ansible/2.4/lineinfile_module.html

answered Sep 2, 2020 by MD
• 95,040 points

Related Questions In Ansible

0 votes
1 answer

Role of subelement module in an Ansible playbook

Hey @Rahul thanks for a better question ...READ MORE

answered Jan 16, 2019 in Ansible by Emily
1,027 views
0 votes
1 answer

lineinfile module in Ansible

You can use the lineinfile module for ...READ MORE

answered Jan 16, 2019 in Ansible by Emily
429 views
0 votes
1 answer

How to replace a line using lineinfile module in Ansible?

Hi@MD, You can use lineinfile module in Ansible. ...READ MORE

answered Sep 2, 2020 in Ansible by akhtar
• 38,170 points
438 views
0 votes
1 answer
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
961 views
+2 votes
1 answer
0 votes
1 answer

How to find the memory of remote systems using the setup module in Ansible?

Hi@akhtar, You need to use the setup module to ...READ MORE

answered Aug 10, 2020 in Ansible by MD
• 95,040 points
788 views
0 votes
1 answer

How to create a group of Managed Nodes in Ansible?

Hi@akhtar, You can use tags in your inventory ...READ MORE

answered Aug 1, 2020 in Ansible by MD
• 95,040 points
103 views