Hi Everyone, I need help on the below task. I have a configuration file in which . . .

Chandra Mohanty:
Hi Everyone, I need help on the below task. I have a configuration file in which there are multiple different lines of strings. Is it possible to search for each line and replace the line with different strings. Not like find and replace same string

Al West:
Yes use with_items

Chandra Mohanty:
ok thanks

Chandra Mohanty:
Could you please share one example?

Al West:

    - name: Replace multiple lines
      lineinfile:
        path: /config_file.txt
        regexp: "{{ item.old }}"
        line: "{{ item.new }}"
      with_items:
        - { old: 'one', new: 'eleven' }
        - { old: 'two', new: 'twelve' }
        - { old: 'three', new: 'thirteen' }

Chandra Mohanty:
thanks a lot