lineinfile

12 views
Skip to first unread message

Govindaraj Venkatesan

unread,
Feb 11, 2016, 4:48:25 PM2/11/16
to Ansible Project
Hi Team,

I have the file with the below content.

  "Bamboo": {
    "Endpoint": "http://xx.xx.xxx.xxx:800",
    "Zookeeper": {
      "Host": "//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",

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?
Reply all
Reply to author
Forward
0 new messages