<h5 dir="auto">ISSUE TYPE</h5>
<p dir="auto">Bug Report</p>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">ansible</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible-playbook 2.3.0 (detached HEAD ba39d1158c) last updated 2017/02/01 12:45:19 (GMT +200)
  config file =
  configured module search path = Default w/o overrides"><pre class="notranslate"><code class="notranslate">ansible-playbook 2.3.0 (detached HEAD ba39d1158c) last updated 2017/02/01 12:45:19 (GMT +200)
  config file =
  configured module search path = Default w/o overrides
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">N/A</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">N/A</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">Handler skipped when same role is called multiple times using "when"</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible-playbook test.yml -e run_first=false -e run_second=true"><pre class="notranslate"><code class="notranslate">ansible-playbook test.yml -e run_first=false -e run_second=true
</code></pre></div>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="---
- hosts: localhost
  connection: local
  roles:
    - { role: a, params: aaa, when: run_first }
    - { role: a, params: bbb, when: run_second }"><pre class="notranslate">---
- <span class="pl-ent">hosts</span>: <span class="pl-s">localhost</span>
  <span class="pl-ent">connection</span>: <span class="pl-s">local</span>
  <span class="pl-ent">roles</span>:
    - <span class="pl-s">{ role: a, params: aaa, when: run_first }</span>
    - <span class="pl-s">{ role: a, params: bbb, when: run_second }</span></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="PLAY [localhost] *********************************************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************************************
ok: [localhost]

TASK [a : command] *******************************************************************************************************************************
skipping: [localhost]

TASK [a : command] *******************************************************************************************************************************
changed: [localhost]

RUNNING HANDLER [a : exec_me] ********************************************************************************************************************
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;exec_me!&quot;
}

PLAY RECAP ***************************************************************************************************************************************
localhost                  : ok=2    changed=1    unreachable=0    failed=0"><pre class="notranslate"><code class="notranslate">PLAY [localhost] *********************************************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************************************
ok: [localhost]

TASK [a : command] *******************************************************************************************************************************
skipping: [localhost]

TASK [a : command] *******************************************************************************************************************************
changed: [localhost]

RUNNING HANDLER [a : exec_me] ********************************************************************************************************************
ok: [localhost] =&gt; {
    "msg": "exec_me!"
}

PLAY RECAP ***************************************************************************************************************************************
localhost                  : ok=2    changed=1    unreachable=0    failed=0
</code></pre></div>
<h5 dir="auto">ACTUAL RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="PLAY [localhost] *********************************************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************************************
ok: [localhost]

TASK [a : command] *******************************************************************************************************************************
skipping: [localhost]

TASK [a : command] *******************************************************************************************************************************
changed: [localhost]

RUNNING HANDLER [a : exec_me] ********************************************************************************************************************
skipping: [localhost]

PLAY RECAP ***************************************************************************************************************************************
localhost                  : ok=2    changed=1    unreachable=0    failed=0"><pre class="notranslate"><code class="notranslate">PLAY [localhost] *********************************************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************************************
ok: [localhost]

TASK [a : command] *******************************************************************************************************************************
skipping: [localhost]

TASK [a : command] *******************************************************************************************************************************
changed: [localhost]

RUNNING HANDLER [a : exec_me] ********************************************************************************************************************
skipping: [localhost]

PLAY RECAP ***************************************************************************************************************************************
localhost                  : ok=2    changed=1    unreachable=0    failed=0
</code></pre></div>
<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">become</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.3.0.0
  config file = /usr/home/svc/ansible/test-playbook/ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.13 (default, Apr 15 2017, 01:13:03) [GCC 4.2.1 Compatible FreeBSD Clang 3.8.0 (tags/RELEASE_380/final 262564)]"><pre class="notranslate"><code class="notranslate">ansible 2.3.0.0
  config file = /usr/home/svc/ansible/test-playbook/ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.13 (default, Apr 15 2017, 01:13:03) [GCC 4.2.1 Compatible FreeBSD Clang 3.8.0 (tags/RELEASE_380/final 262564)]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[defaults]
transport = paramiko
become_ask_pass = True
host_key_checking = False

[ssh_connection]
ssh_args=-o ForwardAgent=yes"><pre class="notranslate"><code class="notranslate">[defaults]
transport = paramiko
become_ask_pass = True
host_key_checking = False

[ssh_connection]
ssh_args=-o ForwardAgent=yes
</code></pre></div>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ uname -a
FreeBSD bsd11.ring.local 11.0-RELEASE-p9 FreeBSD 11.0-RELEASE-p9 #0: Tue Apr 11 08:48:40 UTC 2017     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64"><pre class="notranslate"><code class="notranslate">$ uname -a
FreeBSD bsd11.ring.local 11.0-RELEASE-p9 FreeBSD 11.0-RELEASE-p9 #0: Tue Apr 11 08:48:40 UTC 2017     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
</code></pre></div>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">I'm trying to use a task I've been using with Ansible 2.2.1 on FreeBSD 11 with no problem. But since 2.3.0, Ansible just hangs there on the <code class="notranslate">su</code> command.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>

<p dir="auto">I'm using 2 FreeBSD VM, both install on FreeBSD 11.0 with latest security patches and latest packages installed (<code class="notranslate">pkg install ansible</code>). I'm connecting to the remote VM (vm2) from the local VM (vm1) with a freshly created user with in the <code class="notranslate">wheel</code> group.<br>
Command used:<br>
<code class="notranslate">ansible-playbook -vvvvv -i hosts -u remoteuser -k -K site.yml</code></p>
<p dir="auto"><code class="notranslate">hosts</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[hosts]
vm2 ansible_python_interpreter=/usr/local/bin/python"><pre class="notranslate"><code class="notranslate">[hosts]
vm2 ansible_python_interpreter=/usr/local/bin/python
</code></pre></div>
<p dir="auto"><code class="notranslate">site.yml</code>:</p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="- hosts: all
  become: yes
  become_method: su
  become_user: root
  gather_facts: False
  vars:
    ansible_python_interpreter: &quot;/usr/local/bin/python&quot;

  tasks:
  - name: anything
    raw: '{{ item }}'
    with_items:
      - '/usr/bin/true'"><pre class="notranslate">- <span class="pl-ent">hosts</span>: <span class="pl-s">all</span>
  <span class="pl-ent">become</span>: <span class="pl-s">yes</span>
  <span class="pl-ent">become_method</span>: <span class="pl-s">su</span>
  <span class="pl-ent">become_user</span>: <span class="pl-s">root</span>
  <span class="pl-ent">gather_facts</span>: <span class="pl-c1">False</span>
  <span class="pl-ent">vars</span>:
    <span class="pl-ent">ansible_python_interpreter</span>: <span class="pl-s"><span class="pl-pds">"</span>/usr/local/bin/python<span class="pl-pds">"</span></span>

  <span class="pl-ent">tasks</span>:
  - <span class="pl-ent">name</span>: <span class="pl-s">anything</span>
    <span class="pl-ent">raw</span>: <span class="pl-s"><span class="pl-pds">'</span>{{ item }}<span class="pl-pds">'</span></span>
    <span class="pl-ent">with_items</span>:
      - <span class="pl-s"><span class="pl-pds">'</span>/usr/bin/true<span class="pl-pds">'</span></span></pre></div>

<h5 dir="auto">EXPECTED RESULTS</h5>

<p dir="auto">To get after the <code class="notranslate">/usr/bin/true</code> command and to get back to the shell command line.</p>
<h5 dir="auto">ACTUAL RESULTS</h5>

<p dir="auto">The <code class="notranslate">su</code> root command just hangs there.</p>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Using /usr/home/svc/ansible/test-playbook/ansible.cfg as config file
SSH password:
SUDO password[defaults to SSH password]:
Loading callback plugin default of type stdout, v2.0 from /usr/local/lib/python2.7/site-packages/ansible/plugins/callback/__init__.pyc

PLAYBOOK: site.yml ******************************************************************************************************************************************************************************************
1 plays in site.yml

PLAY [all] **************************************************************************************************************************************************************************************************
META: ran handlers

TASK [anything] *********************************************************************************************************************************************************************************************
task path: /usr/home/svc/ansible/test-playbook/site.yml:10
&lt;vm2&gt; ESTABLISH CONNECTION FOR USER: remoteuser on PORT 22 TO vm2
&lt;vm2&gt; EXEC su  root -c '/bin/sh -c '&quot;'&quot;'echo BECOME-SUCCESS-kvmxtpgoosuvnjtekyyixwwqgkxffkpd; /usr/bin/true'&quot;'&quot;''"><pre class="notranslate"><code class="notranslate">Using /usr/home/svc/ansible/test-playbook/ansible.cfg as config file
SSH password:
SUDO password[defaults to SSH password]:
Loading callback plugin default of type stdout, v2.0 from /usr/local/lib/python2.7/site-packages/ansible/plugins/callback/__init__.pyc

PLAYBOOK: site.yml ******************************************************************************************************************************************************************************************
1 plays in site.yml

PLAY [all] **************************************************************************************************************************************************************************************************
META: ran handlers

TASK [anything] *********************************************************************************************************************************************************************************************
task path: /usr/home/svc/ansible/test-playbook/site.yml:10
&lt;vm2&gt; ESTABLISH CONNECTION FOR USER: remoteuser on PORT 22 TO vm2
&lt;vm2&gt; EXEC su  root -c '/bin/sh -c '"'"'echo BECOME-SUCCESS-kvmxtpgoosuvnjtekyyixwwqgkxffkpd; /usr/bin/true'"'"''
</code></pre></div>
<p dir="auto">Just adding a few more informations:<br>
for Ansible 2.3.0, the current dependencies are:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ pkg info -d ansible
ansible-2.3.0.0:
	py27-pycrypto-2.6.1_1
	py27-paramiko-2.0.5
	py27-netaddr-0.7.18
	python27-2.7.13_2
	py27-setuptools-32.1.0_1
	py27-yaml-3.11_2
	py27-Jinja2-2.9.5"><pre class="notranslate"><code class="notranslate">$ pkg info -d ansible
ansible-2.3.0.0:
	py27-pycrypto-2.6.1_1
	py27-paramiko-2.0.5
	py27-netaddr-0.7.18
	python27-2.7.13_2
	py27-setuptools-32.1.0_1
	py27-yaml-3.11_2
	py27-Jinja2-2.9.5
</code></pre></div>
<p dir="auto">On the working Ansible version 2.2.1 (on another server), dependencies are:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ pkg info -d ansible
ansible-2.2.1.0:
        py27-pycrypto-2.6.1_1
        py27-paramiko-2.0.5
        py27-netaddr-0.7.18
        python27-2.7.13_1
        py27-setuptools-32.1.0_1
        py27-yaml-3.11_2
        py27-Jinja2-2.8"><pre class="notranslate"><code class="notranslate">$ pkg info -d ansible
ansible-2.2.1.0:
        py27-pycrypto-2.6.1_1
        py27-paramiko-2.0.5
        py27-netaddr-0.7.18
        python27-2.7.13_1
        py27-setuptools-32.1.0_1
        py27-yaml-3.11_2
        py27-Jinja2-2.8
</code></pre></div>