I\'m trying insert a line in a property file using ansible. I want to add some property if it does not exist, but not replace it if such property already exists in the file.
We have tried the below and it worked well. our scenario need to entry "compress" in syslog file if it does not exist.
- name: Checking compress entry present if not add entry lineinfile: path: /etc/logrotate.d/syslog regexp: " compress" state: present insertafter: " missingok" line: " compress"