I have to make sure that certain lines are present in the file /etc/postfix/main.cf. I’m not allowed to control the whole file, so I cannot use the template module. The lines are only allowed to exist once in this file, so I cannot use blockinfile, because the same line could exist elsewhere in the file. So I stick with lineinfile and use it like in this example:
Maybe set backup: yes on the first lineinfile task and backup: no on the 2nd and third lineinfile so you only have one backup each time you run the playbook instead of three?