Issue 1:
ISSUE TYPE

Bug Report

COMPONENT NAME

ansible

ANSIBLE VERSION

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

CONFIGURATION

N/A

OS / ENVIRONMENT

N/A

SUMMARY

Handler skipped when same role is called multiple times using "when"

STEPS TO REPRODUCE

ansible-playbook test.yml -e run_first=false -e run_second=true

---
- hosts: localhost
connection: local
roles:
- { role: a, params: aaa, when: run_first }
- { role: a, params: bbb, when: run_second }

EXPECTED RESULTS

PLAY [localhost] *********************************************************************************************************************************

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

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

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

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

PLAY RECAP ***************************************************************************************************************************************
localhost : ok=2 changed=1 unreachable=0 failed=0

ACTUAL RESULTS

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

Issue 2:
ISSUE TYPE

Bug Report

COMPONENT NAME

become

ANSIBLE VERSION

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)]

CONFIGURATION

[defaults]
transport = paramiko
become_ask_pass = True
host_key_checking = False

[ssh_connection]
ssh_args=-o ForwardAgent=yes

OS / ENVIRONMENT

$ 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

SUMMARY

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 su command.

STEPS TO REPRODUCE

I'm using 2 FreeBSD VM, both install on FreeBSD 11.0 with latest security patches and latest packages installed (pkg install ansible). I'm connecting to the remote VM (vm2) from the local VM (vm1) with a freshly created user with in the wheel group.

Command used:

ansible-playbook -vvvvv -i hosts -u remoteuser -k -K site.yml

hosts:

[hosts]
vm2 ansible_python_interpreter=/usr/local/bin/python

site.yml:

- hosts: all
become: yes
become_method: su
become_user: root
gather_facts: False
vars:
ansible_python_interpreter: "/usr/local/bin/python"

tasks:
- name: anything
raw: '{{ item }}'
with_items:
- '/usr/bin/true'

EXPECTED RESULTS

To get after the /usr/bin/true command and to get back to the shell command line.

ACTUAL RESULTS

The su root command just hangs there.

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
<vm2> ESTABLISH CONNECTION FOR USER: remoteuser on PORT 22 TO vm2
<vm2> EXEC su root -c '/bin/sh -c '"'"'echo BECOME-SUCCESS-kvmxtpgoosuvnjtekyyixwwqgkxffkpd; /usr/bin/true'"'"''

Just adding a few more informations:

for Ansible 2.3.0, the current dependencies are:

$ 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

On the working Ansible version 2.2.1 (on another server), dependencies are:

$ 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