replace line in multiple files using lineinfile could anyone please help me.

I found this if it works for you.

---
- name: test loop files
  hosts: server
  gather_facts: no
  vars:
    SVNRepName_Location: /mydata/myserver/ConServer1
    Password: Ansible
  tasks:
    - name: list file and register location
      raw: find /mydata/myserver/ConServer1 -type f -name "files*"
      register: files_found
    - name: debug file
      debug:
        var: files_found.stdout_lines

    - name: use the loop in task replace line in multiple file
      lineinfile:
        dest: "{{item}}"
        regexp: SomeLine
        line: "    Password          : {{ Password }}"
        state: present
      with_items:
        - "{{files_found.stdout_lines}}"

Thank you, J

In (/mydata/myserver/ConServer1 ) i have many files which are different extensions (yml,txt,j2,) how do use (/mydata/myserver/ConServer1 -type f -name “files*”) “files*” do i need to provide same “files*” i don’t understand this ? do i need to provide any file extensions or filenames ?
I was testing step by step for task

  - name: list file and register location
      raw: find /mydata/myserver/ConServer1 -type f -name "files*"
      register: files_found
    - name: debug file
      debug:
        var: files_found.stdout_lines

I got the output

PLAY [localhost] ***************************************************************

TASK [list file and register location] *****************************************
changed: [localhost] => {"changed": true, "rc": 0, "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": []}

TASK [debug file] **************************************************************
ok: [localhost] => {
    "files_found.stdout_lines": []
}

PLAY RECAP *********************************************************************
localhost                  : ok=2    changed=1    unreachable=0    failed=0   


Could you please let me know?

Thanks,
Nav

Thank you, J

It worked for me.

I have updated the raw: find /mydata/myserver/ConServer1 -type f -name “*.yml” .

Listing all the files and replacing them in multiple files.

Thanks,
Nav