I need some suggestion or guidance.. I need to add multiple lines in a file ..sh . . .

Subhankar Banerjee:
I need some suggestion or guidance… I need to add multiple lines in a file …should I use blockinfile inside set_fact …because I need to maintain indentation of those attributes inside file ….

Al West:
You can’t use blockinfile in set_fact

Al West:
Did you mean something like this:

- set_fact:
    my_block: |
      line 1
      line 2
      line 3

- name: Add lines to a file
  blockinfile:
    path: /path/to/your/file
    block: "{{ my_block }}"

Subhankar Banerjee:
thanks for your reply …yes something like this