title: Insert a block of file in a xml
body: <p>I want to insert a block of file into XML using Ansible.</p>
  
  <p>Ex.xml</p>
  
  <pre><code>&lt;t1&gt; ${t1}/k&lt;/t1&gt;
  &lt;v1 c="k.tm"/&gt;
  </code></pre>
  
  <p>I need to insert a block of code between (i.e after <code>&lt;t1&gt; ${t1}/k&lt;/t1&gt;</code>) as per ex.xml</p>
  
  <p>Can anyone help on this?</p>
  
  <p>I tried using block in file but it ended up like this which is adding the block of code at the end of the XML.</p>
  
  <pre><code>- name: add a block
    blockinfile:
      path: ex.xml
      marker: "test"
    block:
      &lt;k1&gt;&lt;/k1&gt;
      &lt;K2&gt;&lt;/k2&gt;
    insertafter: "^&lt;t1&gt; ${t1}/k&lt;/t1&gt;"
  </code></pre>