<h5 dir="auto">Issue Type:</h5>
<p dir="auto">Bug report</p>
<h5 dir="auto">Ansible Version:</h5>
<p dir="auto">ansible 1.4.3</p>
<h5 dir="auto">Environment:</h5>
<p dir="auto">RHEL 6.5 from RHEL 6.5; bug appears to be generic though.</p>
<h5 dir="auto">Summary:</h5>
<p dir="auto">The hack at <a href="https://github.com/ansible/ansible/blob/devel/lib/ansible/runner/__init__.py#L586">https://github.com/ansible/ansible/blob/devel/lib/ansible/runner/__init__.py#L586</a> appears to break filter usage (name={{item | basename }}).</p>
<h5 dir="auto">Steps To Reproduce:</h5>
<p dir="auto">This code:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="  - name: install RPMs
    yum: name=/root/{{ item }}
    notify: restart recursor
    with_items:
    - '{{ recursor_rpm_url | basename }}'
    - '{{ pdnsmgrd_rpm_url | basename }}'"><pre class="notranslate"><code class="notranslate">  - name: install RPMs
    yum: name=/root/{{ item }}
    notify: restart recursor
    with_items:
    - '{{ recursor_rpm_url | basename }}'
    - '{{ pdnsmgrd_rpm_url | basename }}'
</code></pre></div>
<p dir="auto">Should behave identically to:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="  - name: install RPMs
    yum: name=/root/{{ item | basename }}
    notify: restart recursor
    with_items:
    - '{{ recursor_rpm_url }}'
    - '{{ pdnsmgrd_rpm_url }}'"><pre class="notranslate"><code class="notranslate">  - name: install RPMs
    yum: name=/root/{{ item | basename }}
    notify: restart recursor
    with_items:
    - '{{ recursor_rpm_url }}'
    - '{{ pdnsmgrd_rpm_url }}'
</code></pre></div>
<p dir="auto">However, the second version feeds the full URLs (that I have in those vars) to yum.</p>
<p dir="auto">In both cases /root/ is dropped as well, but the first version accepts this because ansible is running from /root anyway.</p>
<h5 dir="auto">Expected Results:</h5>
<p dir="auto">Both versions do the same, honoring /root and | basename.</p>
<h5 dir="auto">Actual Results:</h5>
<p dir="auto">One version works, mostly by accident. The other does not work at all.</p>
<p dir="auto">This is regarding the discussion at <a href="https://groups.google.com/forum/#!topic/ansible-project/89nAO_ncAs0" rel="nofollow">https://groups.google.com/forum/#!topic/ansible-project/89nAO_ncAs0</a></p>
<p dir="auto">The idea is to be able to add a prefix to apt and yum so that the following would work:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="- name: PHP | MAIN | Install php packages
  apt: &gt;
    pkg=php5-{{ item }}
    state=latest
  with_items: 
    - cli
    - intl
    - mcrypt
    - curl
  sudo: yes"><pre class="notranslate"><code class="notranslate">- name: PHP | MAIN | Install php packages
  apt: &gt;
    pkg=php5-{{ item }}
    state=latest
  with_items: 
    - cli
    - intl
    - mcrypt
    - curl
  sudo: yes
</code></pre></div>
<p dir="auto">A suggestion from James Tanner:</p>
<blockquote>
<p dir="auto">One possible solution is to add a pkg_prefix option to the apt and yum modules.</p>
</blockquote>