Ansible Regex (Python) exclude operation
<p>Ansible uses python regex to search a pattern and replace strings.
DOC link: <a href="http://docs.ansible.com/ansible/lineinfile_module.html" rel="nofollow">http://docs.ansible.com/ansible/lineinfile_module.html</a> </p>

<p>Below line is one of lines in the file "file.txt".</p>

<p>JAVA_OPT="firststring=value"</p>

<p>I want to concatenate it with the string 'secondstring=value' and avoid concatenation operation if the string is there.</p>

<p>lineinfile: dest="/home/abc/file.txt" regexp='^JAVA_OPT="(.*)"' line='JAVA_OPT="\1 secondstring=value"' backrefs="yes"</p>

<p>I want below string irrespective of multiple runs. Currently, it concatenates the string in every run.
JAVA_OPT="firststring=value secondstring=value"</p>