A with_items loop in ansible can be used to easily loop over values.
with_items
- name: Add lines to this file lineinfile: dest=/etc/file line={{ item }} state=present with_items: - Line 1 - Line 2 - Line 3