<p dir="auto">Could we extend roles to support scripts?</p>
<p dir="auto">So</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="- script: myscript.sh"><pre class="notranslate"><code class="notranslate">- script: myscript.sh
</code></pre></div>
<p dir="auto">Gets automagically sucked up from, roles/myrole/scripts/myscript.sh</p>
<p dir="auto">?</p>
<p dir="auto">From <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/rfwekker/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/rfwekker">@rfwekker</a> on 2016-12-05T14:38:56Z</p>
<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">lineinfile module<br>
<a href="http://docs.ansible.com/ansible/lineinfile_module.html" rel="nofollow">http://docs.ansible.com/ansible/lineinfile_module.html</a></p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<p dir="auto">ansible 2.1.0.0</p>
<h5 dir="auto">ENVIRONMENT</h5>
<p dir="auto">Ansible Configuration: default<br>
CentOS Linux release 7.2.1511 (Core) 3.10.0-327.36.1.el7.x86_64</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">BUG: The lastline is deleted and replaced, with lineinfile insertafter=EOF<br>
Want to add a new string to the end of the file, but the result is that the lastline is deleted and replaced. Replace last line instead of insert after last line.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">/etc/crontab</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="*/45 *  *  *  *  root /sbin/blabla
*/45 *  *  *  *  root /sbin/tratra"><pre class="notranslate"><code class="notranslate">*/45 *  *  *  *  root /sbin/blabla
*/45 *  *  *  *  root /sbin/tratra
</code></pre></div>
<p dir="auto">Playbook section:</p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content=" - name: add at the end of the file /etc/crontab rhn_check
   lineinfile: dest=/etc/crontab
               regexp=''
               insertafter=EOF
               line='*/60 *  *  *  *  root /sbin/rhn_chk'"><pre class="notranslate"> - <span class="pl-ent">name</span>: <span class="pl-s">add at the end of the file /etc/crontab rhn_check</span>
   <span class="pl-ent">lineinfile</span>: <span class="pl-s">dest=/etc/crontab</span>
               <span class="pl-s">regexp=''</span>
               <span class="pl-s">insertafter=EOF</span>
               <span class="pl-s">line='*/60 *  *  *  *  root /sbin/rhn_chk'</span></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">Line added to the crontab</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="*/45 *  *  *  *  root /sbin/blabla
*/45 *  *  *  *  root /sbin/tratra
*/60 *  *  *  *  root /sbin/rhn_chk"><pre class="notranslate"><code class="notranslate">*/45 *  *  *  *  root /sbin/blabla
*/45 *  *  *  *  root /sbin/tratra
*/60 *  *  *  *  root /sbin/rhn_chk
</code></pre></div>
<h5 dir="auto">ACTUAL RESULTS</h5>
<p dir="auto">/etc/crontab</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="*/45 *  *  *  *  root /sbin/blabla
*/60 *  *  *  *  root /sbin/rhn_chk"><pre class="notranslate"><code class="notranslate">*/45 *  *  *  *  root /sbin/blabla
*/60 *  *  *  *  root /sbin/rhn_chk
</code></pre></div>
<p dir="auto">Last line in the file deleted and replaced</p>
<p dir="auto">Copied from original issue: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="193514460" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible-modules-core/issues/5825" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible-modules-core/issues/5825/hovercard" href="https://github.com/ansible/ansible-modules-core/issues/5825">ansible/ansible-modules-core#5825</a></p>