# lineinfile

**URL:** <https://forum.ansible.com/t/lineinfile/20550>\
**Category:** Ansible Project\
**Created:** [February 11, 2016, 9:23pm UTC](https://forum.ansible.com/t/lineinfile/20550 "2016-02-11T21:23:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Govindaraj\_Venkatesa](https://avatars.discourse-cdn.com/v4/letter/g/a698b9/32.png) [@Govindaraj\_Venkatesa](https://forum.ansible.com/u/Govindaraj_Venkatesa)\
**Post date:** [February 11, 2016, 9:23pm UTC](https://forum.ansible.com/t/lineinfile/20550/1 "2016-02-11T21:23:00Z")

</div>

Hi Team,

I have the file with the below content.

“Bamboo”: {  
“Endpoint”: “[http://xx.xx.xxx.xxx:800](http://xx.xx.xxx.xxx:800)”,  
“Zookeeper”: {  
“Host”: “[//xx.xxx.xxx.xx:2181](https://xx.xxx.xxx.xx:2181),xx.xxx.xxx.xx:2181,xx.xxx.xxx.xx:2181”,  
“Path”: “/marathon-haproxy/state”,  
“ReportingDelay”: 5  
}  
},

I wanted to dynamically update the below line using lineinfile  
“Endpoint”: “[http://xx.xx.xxx.xxx:800](http://xx.xx.xxx.xxx:800)”,

My Ansible has the below code  
lineinfile: dest=/var/bamboo/production.json.bak state=present regexp=“^ "Bamboo"”:" {" insertafter=" "Bamboo"“:”{" line=" "Endpoint"“:” "http://{{ansible\_default\_ipv4.address}}:8080" "

For some reason, it is adding the line to the EOF.

Can someone please suggest on how can i fix it?
