identation and spaces with lininfile

319 views
Skip to first unread message

Tony Wong

unread,
Jul 20, 2022, 12:44:09 PM7/20/22
to Ansible Project
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 }}" }

Mike Eggleston

unread,
Jul 20, 2022, 1:12:16 PM7/20/22
to ansible...@googlegroups.com
Add spaces inside the double quote?

Mike

On Jul 20, 2022, at 11:44, Tony Wong <tdub...@gmail.com> wrote:

I am really stuck trying to insert a line with lineinfile with 5 space indentation
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/96481aa3-abba-4448-a48c-3870e15a76f2n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages