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 }}” }