On Mon, 8 Mar 2021 06:33:03 -0800 (PST)
"dudu.c...@gmail.com" <dudu.conf...@gmail.com> wrote:

> - name: update file
>   lineinfile:
>     path: {{ item }} *<-- This should describe the files*
>     regexp: "{{ item.from }}"
>     line: "{{ item.replace_with }}"
>   with_items:
>      - { from: parameter1= , replace_with: parameter1=test1 }
>      - { from: parameter1= , replace_with: parameter1=test2 }
>   with_items:  *-- > This should be for the path*
>      - “/opt/file1”   
>      - “/opt/file2” 

Try this

 - name: update file
   lineinfile:
     path: "{{ item.0 }}"
     regexp: "{{ item.1.from }}"
     line: "{{ item.1.replace_with }}"
   with_nested:
      - - “/opt/file1”   
        - “/opt/file2” 
      - - {from: parameter1=, replace_with: parameter1=test1}
        - {from: parameter1=, replace_with: parameter1=test2}

(not tested)

-- 
Vladimir Botka

-- 
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-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20210308155804.17e2826e%40gmail.com.

Attachment: pgpGjWlRfroJI.pgp
Description: OpenPGP digital signature

Reply via email to