# identation and spaces with lininfile

**URL:** <https://forum.ansible.com/t/identation-and-spaces-with-lininfile/36878>\
**Category:** Ansible Project\
**Created:** [July 20, 2022, 4:44pm UTC](https://forum.ansible.com/t/identation-and-spaces-with-lininfile/36878 "2022-07-20T16:44:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tony\_Wong](https://avatars.discourse-cdn.com/v4/letter/t/3ab097/32.png) [@Tony\_Wong](https://forum.ansible.com/u/Tony_Wong)\
**Post date:** [July 20, 2022, 4:44pm UTC](https://forum.ansible.com/t/identation-and-spaces-with-lininfile/36878/1 "2022-07-20T16:44:09Z")

</div>

I am really stuck trying to insert a line with lineinfile with 5 space indentation

any idea?

task is

- name: add line  
lineinfile:  
backup: no  
#backrefs: yes  
state: present  
path: “{{ file\_path }}”  
#regexp: ‘^(\s\*)[#]?{{ item.search }}(: )\*’  
insertafter: “{{ line.replace\_with }}”  
**line: “\n{{ line.line\_to\_add }}”**  
#line: ‘\1{{ item.search }}\2\n\1{{ item.add }}’  
with\_items:
- { search: “{{ line.replace\_with }}”, add: “{{ line.line\_to\_add }}” }

---

<div class="post-metadata">

**Author:** ![Mike\_Eggleston](https://avatars.discourse-cdn.com/v4/letter/m/58956e/32.png) [@Mike\_Eggleston](https://forum.ansible.com/u/Mike_Eggleston)\
**Post date:** [July 20, 2022, 5:12pm UTC](https://forum.ansible.com/t/identation-and-spaces-with-lininfile/36878/2 "2022-07-20T17:12:04Z")

</div>

Add spaces inside the double quote?

Mike
