Below is the sample of the lineinfile module that I used. The first time run the playbook, it successfully change the line with the new line.
However, after I run one more time the playbook, it still add the line at the bottom of the file.
- name: Change abc
lineinfile:
dest: “{{ abc }}”
state: present
regexp: ’ http://{{ ansible_fqdn }}:{{ wabc_port }}’
line: ’ https://{{ ansible_fqdn }}:{{ abc_port_https }}’
How should it works?