ansible / ansible

Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy and maintain. Automate everything from code deployment to network configuration to cloud management, in a language that approaches plain English, using SSH, with no agents to install on remote systems. https://docs.ansible.com.
https://www.ansible.com/
GNU General Public License v3.0
62.44k stars 23.82k forks source link

free strategy skips last include_tasks when using with_nested inside a role #28878

Closed ghost closed 6 years ago

ghost commented 7 years ago
ISSUE TYPE
COMPONENT NAME

plugins/strategy/free

ANSIBLE VERSION
ansible 2.4.0 (devel a6af204cee) last updated 2017/08/31 15:04:30 (GMT +200)
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/user/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/user/src/ansible/lib/ansible
  executable location = /home/user/src/ansible/bin/ansible
  python version = 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118]
ansible 2.3.2.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/user/ansible/modules']
  python version = 2.7.9 (default, Jun 29 2016, 13:08:31) [GCC 4.9.2]
CONFIGURATION
OS / ENVIRONMENT

N/A

SUMMARY

Tasks from the last include_tasks-call are not executed when using the free strategy and with_nested. This seems to only affect roles, I could not reproduce it using only tasks.

STEPS TO REPRODUCE

Run the playbook. $ ansible-playbook -i hosts site.yml Change include_tasks to include when using ansible 2.3


.
|-- hosts
|-- roles
|   `-- role-using-with_nested-to-include
|       `-- tasks
|           |-- first-include.yml
|           |-- fourth-include.yml
|           |-- main.yml
|           |-- second-include.yml
|           `-- third-include.yml
`-- site.yml

hosts:

localhost

site.yml:

---
 - hosts: all
   remote_user: user
   strategy: free
   roles:
    - role-using-with_nested-to-include

roles/role-using-with_nested-to-include/tasks/main.yml:

---
 - include_tasks: first-include.yml
 - include_tasks: second-include.yml
   with_nested:
    - [ 'foo' ]
    - [ 'bar' ]
 - include_tasks: third-include.yml
   with_nested:
    - [ 'foo' ]
    - [ 'bar' ]
# comment out fourth-include.yml and third-include.yml will no longer be executed
 - include_tasks: fourth-include.yml
   with_nested:
    - [ 'foo' ]
    - [ 'bar' ]

roles/role-using-with_nested-to-include/tasks/first-include:

---
 - debug: msg="hello world"

roles/role-using-with_nested-to-include/tasks/second-include:

---
- debug: msg="dlrow olleh"

roles/role-using-with_nested-to-include/tasks/third-include:

---
 - debug: msg="world hello"

roles/role-using-with_nested-to-include/tasks/fourth-include:

---
 - debug: msg="dlrow olleh"
EXPECTED RESULTS

Same results as when using the linear strategy, see the output below. All tasks have been executed.

user@stretch:~/playbook-with-role$ ansible-playbook -i hosts site.yml 

PLAY [all] ********************************************************************************************************************************************************************************************************

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

TASK [role-using-with_nested-to-include : include_tasks] **********************************************************************************************************************************************************
included: /home/user/playbook-with-role/roles/role-using-with_nested-to-include/tasks/first-include.yml for localhost

TASK [role-using-with_nested-to-include : debug] ******************************************************************************************************************************************************************
ok: [localhost] => {
    "msg": "hello world"
}

TASK [role-using-with_nested-to-include : include_tasks] **********************************************************************************************************************************************************
included: /home/user/playbook-with-role/roles/role-using-with_nested-to-include/tasks/second-include.yml for localhost

TASK [role-using-with_nested-to-include : debug] ******************************************************************************************************************************************************************
ok: [localhost] => {
    "msg": "dlrow olleh"
}

TASK [role-using-with_nested-to-include : include_tasks] **********************************************************************************************************************************************************
included: /home/user/playbook-with-role/roles/role-using-with_nested-to-include/tasks/third-include.yml for localhost

TASK [role-using-with_nested-to-include : debug] ******************************************************************************************************************************************************************
ok: [localhost] => {
    "msg": "world hello"
}

TASK [role-using-with_nested-to-include : include_tasks] **********************************************************************************************************************************************************
included: /home/user/playbook-with-role/roles/role-using-with_nested-to-include/tasks/fourth-include.yml for localhost

TASK [role-using-with_nested-to-include : debug] ******************************************************************************************************************************************************************
ok: [localhost] => {
    "msg": "dlrow olleh"
}

PLAY RECAP ********************************************************************************************************************************************************************************************************
localhost                  : ok=9    changed=0    unreachable=0    failed=0
ACTUAL RESULTS

Last task has been skipped.

user@stretch:~/playbook-with-role$ ansible-playbook -vvvv -i hosts site.yml 
ansible-playbook 2.4.0 (devel a6af204cee) last updated 2017/08/31 15:04:30 (GMT +200)
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/user/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/user/src/ansible/lib/ansible
  executable location = /home/user/src/ansible/bin/ansible-playbook
  python version = 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118]
Using /etc/ansible/ansible.cfg as config file
setting up inventory plugins
Set default localhost to localhost
Parsed /home/user/playbook-with-role/hosts inventory source with ini plugin
Loading callback plugin default of type stdout, v2.0 from /home/user/src/ansible/lib/ansible/plugins/callback/__init__.pyc

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

PLAY [all] ********************************************************************************************************************************************************************************************************
Using module file /home/user/src/ansible/lib/ansible/modules/system/setup.py
<localhost> ESTABLISH SSH CONNECTION FOR USER: user
<localhost> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=user -o ConnectTimeout=10 -o ControlPath=/home/user/.ansible/cp/5c0a48d51b localhost '/bin/sh -c '"'"'echo ~ && sleep 0'"'"''
<localhost> (0, '/home/user\n', 'OpenSSH_7.4p1 Debian-10+deb9u1, OpenSSL 1.0.2l  25 May 2017\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug1: Control socket "/home/user/.ansible/cp/5c0a48d51b" does not exist\r\ndebug2: resolving "localhost" port 22\r\ndebug2: ssh_connect_direct: needpriv 0\r\ndebug1: Connecting to localhost [::1] port 22.\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: fd 3 clearing O_NONBLOCK\r\ndebug1: Connection established.\r\ndebug3: timeout: 10000 ms remain after connect\r\ndebug1: key_load_public: No such file or directory\r\ndebug1: identity file /home/user/.ssh/id_rsa type -1\r\ndebug1: key_load_public: No such file or directory\r\ndebug1: identity file /home/user/.ssh/id_rsa-cert type -1\r\ndebug1: key_load_public: No such file or directory\r\ndebug1: identity file /home/user/.ssh/id_dsa type -1\r\ndebug1: key_load_public: No such file or directory\r\ndebug1: identity file /home/user/.ssh/id_dsa-cert type -1\r\ndebug1: key_load_public: No such file or directory\r\ndebug1: identity file /home/user/.ssh/id_ecdsa type -1\r\ndebug1: key_load_public: No such file or directory\r\ndebug1: identity file /home/user/.ssh/id_ecdsa-cert type -1\r\ndebug1: key_load_public: No such file or directory\r\ndebug1: identity file /home/user/.ssh/id_ed25519 type -1\r\ndebug1: key_load_public: No such file or directory\r\ndebug1: identity file /home/user/.ssh/id_ed25519-cert type -1\r\ndebug1: Enabling compatibility mode for protocol 2.0\r\ndebug1: Local version string SSH-2.0-OpenSSH_7.4p1 Debian-10+deb9u1\r\ndebug1: Remote protocol version 2.0, remote software version OpenSSH_7.4p1 Debian-10+deb9u1\r\ndebug1: match: OpenSSH_7.4p1 Debian-10+deb9u1 pat OpenSSH* compat 0x04000000\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug1: Authenticating to localhost:22 as \'user\'\r\ndebug3: hostkeys_foreach: reading file "/home/user/.ssh/known_hosts"\r\ndebug3: record_hostkey: found key type ECDSA in file /home/user/.ssh/known_hosts:3\r\ndebug3: load_hostkeys: loaded 1 keys from localhost\r\ndebug3: order_hostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521\r\ndebug3: send packet: type 20\r\ndebug1: SSH2_MSG_KEXINIT sent\r\ndebug3: receive packet: type 20\r\ndebug1: SSH2_MSG_KEXINIT received\r\ndebug2: local client KEXINIT proposal\r\ndebug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c\r\ndebug2: host key algorithms: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa\r\ndebug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc\r\ndebug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc\r\ndebug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1\r\ndebug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1\r\ndebug2: compression ctos: zlib@openssh.com,zlib,none\r\ndebug2: compression stoc: zlib@openssh.com,zlib,none\r\ndebug2: languages ctos: \r\ndebug2: languages stoc: \r\ndebug2: first_kex_follows 0 \r\ndebug2: reserved 0 \r\ndebug2: peer server KEXINIT proposal\r\ndebug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1\r\ndebug2: host key algorithms: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519\r\ndebug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com\r\ndebug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com\r\ndebug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1\r\ndebug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1\r\ndebug2: compression ctos: none,zlib@openssh.com\r\ndebug2: compression stoc: none,zlib@openssh.com\r\ndebug2: languages ctos: \r\ndebug2: languages stoc: \r\ndebug2: first_kex_follows 0 \r\ndebug2: reserved 0 \r\ndebug1: kex: algorithm: curve25519-sha256\r\ndebug1: kex: host key algorithm: ecdsa-sha2-nistp256\r\ndebug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: zlib@openssh.com\r\ndebug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: zlib@openssh.com\r\ndebug3: send packet: type 30\r\ndebug1: expecting SSH2_MSG_KEX_ECDH_REPLY\r\ndebug3: receive packet: type 31\r\ndebug1: Server host key: ecdsa-sha2-nistp256 SHA256:Jsp+Ohn6np89FHY1jvSlqK9PmVyXE29AYlSUXvy8pJg\r\ndebug3: hostkeys_foreach: reading file "/home/user/.ssh/known_hosts"\r\ndebug3: record_hostkey: found key type ECDSA in file /home/user/.ssh/known_hosts:3\r\ndebug3: load_hostkeys: loaded 1 keys from localhost\r\ndebug1: Host \'localhost\' is known and matches the ECDSA host key.\r\ndebug1: Found key in /home/user/.ssh/known_hosts:3\r\ndebug3: send packet: type 21\r\ndebug2: set_newkeys: mode 1\r\ndebug1: rekey after 134217728 blocks\r\ndebug1: SSH2_MSG_NEWKEYS sent\r\ndebug1: expecting SSH2_MSG_NEWKEYS\r\ndebug3: receive packet: type 21\r\ndebug1: SSH2_MSG_NEWKEYS received\r\ndebug2: set_newkeys: mode 0\r\ndebug1: rekey after 134217728 blocks\r\ndebug2: key: /home/user/.ssh/id_rsa ((nil))\r\ndebug2: key: /home/user/.ssh/id_dsa ((nil))\r\ndebug2: key: /home/user/.ssh/id_ecdsa ((nil))\r\ndebug2: key: /home/user/.ssh/id_ed25519 ((nil))\r\ndebug3: send packet: type 5\r\ndebug3: receive packet: type 7\r\ndebug1: SSH2_MSG_EXT_INFO received\r\ndebug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>\r\ndebug3: receive packet: type 6\r\ndebug2: service_accept: ssh-userauth\r\ndebug1: SSH2_MSG_SERVICE_ACCEPT received\r\ndebug3: send packet: type 50\r\ndebug3: receive packet: type 51\r\ndebug1: Authentications that can continue: publickey,password\r\ndebug3: start over, passed a different list publickey,password\r\ndebug3: preferred gssapi-with-mic,gssapi-keyex,hostbased,publickey\r\ndebug3: authmethod_lookup publickey\r\ndebug3: remaining preferred: ,gssapi-keyex,hostbased,publickey\r\ndebug3: authmethod_is_enabled publickey\r\ndebug1: Next authentication method: publickey\r\ndebug3: send_pubkey_test\r\ndebug3: send packet: type 50\r\ndebug2: we sent a publickey packet, wait for reply\r\ndebug3: receive packet: type 60\r\ndebug1: Server accepts key: pkalg ssh-rsa blen 535\r\ndebug2: input_userauth_pk_ok: fp SHA256:o9NJMPA5PWcVMGdeJGQtqFpVfNcefiW1Huk+jQ5KjS8\r\ndebug3: sign_and_send_pubkey: RSA SHA256:o9NJMPA5PWcVMGdeJGQtqFpVfNcefiW1Huk+jQ5KjS8\r\ndebug3: send packet: type 50\r\ndebug3: receive packet: type 52\r\ndebug1: Enabling compression at level 6.\r\ndebug1: Authentication succeeded (publickey).\r\nAuthenticated to localhost ([::1]:22).\r\ndebug1: setting up multiplex master socket\r\ndebug3: muxserver_listen: temporary control path /home/user/.ansible/cp/5c0a48d51b.FGJAeTI1YuQPVmtV\r\ndebug2: fd 5 setting O_NONBLOCK\r\ndebug3: fd 5 is O_NONBLOCK\r\ndebug3: fd 5 is O_NONBLOCK\r\ndebug1: channel 0: new [/home/user/.ansible/cp/5c0a48d51b]\r\ndebug3: muxserver_listen: mux listener channel 0 fd 5\r\ndebug2: fd 3 setting TCP_NODELAY\r\ndebug3: ssh_packet_set_tos: set IPV6_TCLASS 0x08\r\ndebug1: control_persist_detach: backgrounding master process\r\ndebug2: control_persist_detach: background process is 3237\r\ndebug2: fd 5 setting O_NONBLOCK\r\ndebug1: forking to background\r\ndebug1: Entering interactive session.\r\ndebug1: pledge: id\r\ndebug2: set_control_persist_exit_time: schedule exit in 60 seconds\r\ndebug1: multiplexing control connection\r\ndebug2: fd 6 setting O_NONBLOCK\r\ndebug3: fd 6 is O_NONBLOCK\r\ndebug1: channel 1: new [mux-control]\r\ndebug3: channel_post_mux_listener: new mux channel 1 fd 6\r\ndebug3: mux_master_read_cb: channel 1: hello sent\r\ndebug2: set_control_persist_exit_time: cancel scheduled exit\r\ndebug3: mux_master_read_cb: channel 1 packet type 0x00000001 len 4\r\ndebug2: process_mux_master_hello: channel 1 slave version 4\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_master_read_cb: channel 1 packet type 0x10000004 len 4\r\ndebug2: process_mux_alive_check: channel 1: alive check\r\ndebug3: mux_client_request_alive: done pid = 3239\r\ndebug3: mux_client_request_session: session request sent\r\ndebug3: mux_master_read_cb: channel 1 packet type 0x10000002 len 90\r\ndebug2: process_mux_new_session: channel 1: request tty 0, X 0, agent 0, subsys 0, term "xterm-256color", cmd "/bin/sh -c \'echo ~ && sleep 0\'", env 1\r\ndebug3: process_mux_new_session: got fds stdin 7, stdout 8, stderr 9\r\ndebug2: fd 8 setting O_NONBLOCK\r\ndebug2: fd 9 setting O_NONBLOCK\r\ndebug1: channel 2: new [client-session]\r\ndebug2: process_mux_new_session: channel_new: 2 linked to control channel 1\r\ndebug2: channel 2: send open\r\ndebug3: send packet: type 90\r\ndebug3: receive packet: type 80\r\ndebug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0\r\ndebug3: receive packet: type 91\r\ndebug2: callback start\r\ndebug2: client_session2_setup: id 2\r\ndebug1: Sending environment.\r\ndebug1: Sending env LANG = C\r\ndebug2: channel 2: request env confirm 0\r\ndebug3: send packet: type 98\r\ndebug1: Sending command: /bin/sh -c \'echo ~ && sleep 0\'\r\ndebug2: channel 2: request exec confirm 1\r\ndebug3: send packet: type 98\r\ndebug3: mux_session_confirm: sending success reply\r\ndebug2: callback done\r\ndebug2: channel 2: open confirm rwindow 0 rmax 32768\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug2: channel 2: rcvd adjust 2097152\r\ndebug3: receive packet: type 99\r\ndebug2: channel_input_status_confirm: type 99 id 2\r\ndebug2: exec request accepted on channel 2\r\ndebug3: receive packet: type 98\r\ndebug1: client_input_channel_req: channel 2 rtype exit-status reply 0\r\ndebug3: mux_exit_message: channel 2: exit message, exitval 0\r\ndebug3: receive packet: type 98\r\ndebug1: client_input_channel_req: channel 2 rtype eow@openssh.com reply 0\r\ndebug2: channel 2: rcvd eow\r\ndebug2: channel 2: close_read\r\ndebug2: channel 2: input open -> closed\r\ndebug3: receive packet: type 96\r\ndebug2: channel 2: rcvd eof\r\ndebug2: channel 2: output open -> drain\r\ndebug2: channel 2: obuf empty\r\ndebug2: channel 2: close_write\r\ndebug2: channel 2: output drain -> closed\r\ndebug3: receive packet: type 97\r\ndebug2: channel 2: rcvd close\r\ndebug3: channel 2: will not send data after close\r\ndebug2: channel 2: send close\r\ndebug3: send packet: type 97\r\ndebug2: channel 2: is dead\r\ndebug2: channel 2: gc: notify user\r\ndebug3: mux_master_session_cleanup_cb: entering for channel 2\r\ndebug2: channel 1: rcvd close\r\ndebug2: channel 1: output open -> drain\r\ndebug2: channel 1: close_read\r\ndebug2: channel 1: input open -> closed\r\ndebug2: channel 2: gc: user detached\r\ndebug2: channel 2: is dead\r\ndebug2: channel 2: garbage collecting\r\ndebug1: channel 2: free: client-session, nchannels 3\r\ndebug3: channel 2: status: The following connections are open:\r\n  #1 mux-control (t16 r-1 i3/0 o1/16 fd 6/6 cc -1)\r\n  #2 client-session (t4 r0 i3/0 o3/0 fd -1/-1 cc -1)\r\n\r\ndebug2: channel 1: obuf empty\r\ndebug2: channel 1: close_write\r\ndebug2: channel 1: output drain -> closed\r\ndebug2: channel 1: is dead (local)\r\ndebug2: channel 1: gc: notify user\r\ndebug3: mux_master_control_cleanup_cb: entering for channel 1\r\ndebug2: channel 1: gc: user detached\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: channel 1: is dead (local)\r\ndebug2: channel 1: garbage collecting\r\ndebug1: channel 1: free: mux-control, nchannels 2\r\ndebug2: Received exit status from master 0\r\ndebug3: channel 1: status: The following connections are open:\r\n  #1 mux-control (t16 r-1 i3/0 o3/0 fd 6/6 cc -1)\r\n\r\ndebug2: set_control_persist_exit_time: schedule exit in 60 seconds\r\n')
<localhost> ESTABLISH SSH CONNECTION FOR USER: user
<localhost> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=user -o ConnectTimeout=10 -o ControlPath=/home/user/.ansible/cp/5c0a48d51b localhost '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /home/user/.ansible/tmp/ansible-tmp-1504186732.12-35775108317679 `" && echo ansible-tmp-1504186732.12-35775108317679="` echo /home/user/.ansible/tmp/ansible-tmp-1504186732.12-35775108317679 `" ) && sleep 0'"'"''
<localhost> (0, 'ansible-tmp-1504186732.12-35775108317679=/home/user/.ansible/tmp/ansible-tmp-1504186732.12-35775108317679\n', 'OpenSSH_7.4p1 Debian-10+deb9u1, OpenSSL 1.0.2l  25 May 2017\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 3239\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
<localhost> PUT /tmp/tmpzgP7C7 TO /home/user/.ansible/tmp/ansible-tmp-1504186732.12-35775108317679/setup.py
<localhost> SSH: EXEC sftp -b - -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=user -o ConnectTimeout=10 -o ControlPath=/home/user/.ansible/cp/5c0a48d51b '[localhost]'
<localhost> (0, 'sftp> put /tmp/tmpzgP7C7 /home/user/.ansible/tmp/ansible-tmp-1504186732.12-35775108317679/setup.py\n', 'OpenSSH_7.4p1 Debian-10+deb9u1, OpenSSL 1.0.2l  25 May 2017\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 3239\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug2: Remote version: 3\r\ndebug2: Server supports extension "posix-rename@openssh.com" revision 1\r\ndebug2: Server supports extension "statvfs@openssh.com" revision 2\r\ndebug2: Server supports extension "fstatvfs@openssh.com" revision 2\r\ndebug2: Server supports extension "hardlink@openssh.com" revision 1\r\ndebug2: Server supports extension "fsync@openssh.com" revision 1\r\ndebug3: Sent message fd 5 T:16 I:1\r\ndebug3: SSH_FXP_REALPATH . -> /home/user size 0\r\ndebug3: Looking up /tmp/tmpzgP7C7\r\ndebug3: Sent message fd 5 T:17 I:2\r\ndebug3: Received stat reply T:101 I:2\r\ndebug1: Couldn\'t stat remote file: No such file or directory\r\ndebug3: Sent message SSH2_FXP_OPEN I:3 P:/home/user/.ansible/tmp/ansible-tmp-1504186732.12-35775108317679/setup.py\r\ndebug3: Sent message SSH2_FXP_WRITE I:4 O:0 S:32768\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: In write loop, ack for 4 32768 bytes at 0\r\ndebug3: Sent message SSH2_FXP_WRITE I:5 O:32768 S:32768\r\ndebug3: Sent message SSH2_FXP_WRITE I:6 O:65536 S:32768\r\ndebug3: Sent message SSH2_FXP_WRITE I:7 O:98304 S:32768\r\ndebug3: Sent message SSH2_FXP_WRITE I:8 O:131072 S:32768\r\ndebug3: Sent message SSH2_FXP_WRITE I:9 O:163840 S:31576\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: In write loop, ack for 5 32768 bytes at 32768\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: In write loop, ack for 6 32768 bytes at 65536\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: In write loop, ack for 7 32768 bytes at 98304\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: In write loop, ack for 8 32768 bytes at 131072\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: In write loop, ack for 9 31576 bytes at 163840\r\ndebug3: Sent message SSH2_FXP_CLOSE I:4\r\ndebug3: SSH2_FXP_STATUS 0\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
<localhost> ESTABLISH SSH CONNECTION FOR USER: user
<localhost> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=user -o ConnectTimeout=10 -o ControlPath=/home/user/.ansible/cp/5c0a48d51b localhost '/bin/sh -c '"'"'chmod u+x /home/user/.ansible/tmp/ansible-tmp-1504186732.12-35775108317679/ /home/user/.ansible/tmp/ansible-tmp-1504186732.12-35775108317679/setup.py && sleep 0'"'"''
<localhost> (0, '', 'OpenSSH_7.4p1 Debian-10+deb9u1, OpenSSL 1.0.2l  25 May 2017\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 3239\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n')
<localhost> ESTABLISH SSH CONNECTION FOR USER: user
<localhost> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=user -o ConnectTimeout=10 -o ControlPath=/home/user/.ansible/cp/5c0a48d51b -tt localhost '/bin/sh -c '"'"'/usr/bin/python /home/user/.ansible/tmp/ansible-tmp-1504186732.12-35775108317679/setup.py; rm -rf "/home/user/.ansible/tmp/ansible-tmp-1504186732.12-35775108317679/" > /dev/null 2>&1 && sleep 0'"'"''
<localhost> (0, '\r\n{"invocation": {"module_args": {"filter": "*", "gather_subset": ["all"], "fact_path": "/etc/ansible/facts.d", "gather_timeout": 10}}, "ansible_facts": {"ansible_product_serial": "NA", "ansible_form_factor": "Other", "ansible_product_version": "4.7.1-1.4", "ansible_fips": false, "ansible_service_mgr": "systemd", "ansible_user_id": "user", "ansible_selinux_python_present": true, "ansible_userspace_bits": "64", "ansible_all_ipv4_addresses": ["10.16.20.43"], "gather_subset": ["all"], "ansible_architecture": "x86_64", "ansible_local": {}, "ansible_distribution_version": "9.1", "ansible_domain": "", "ansible_distribution_file_path": "/etc/os-release", "ansible_device_links": {"masters": {}, "labels": {}, "ids": {"sr0": ["ata-QEMU_DVD-ROM_QM00004"]}, "uuids": {"xvda5": ["072dfa9b-a1a2-431e-b98c-019464fca0b2"], "xvda1": ["25255b15-8bd1-44db-8fe2-1b6bff2cb2ed"]}}, "ansible_virtualization_type": "xen", "ansible_real_user_id": 1001, "ansible_processor_cores": 4, "ansible_virtualization_role": "guest", "ansible_distribution_file_variety": "Debian", "ansible_dns": {"nameservers": ["10.16.30.1", "10.16.30.2"]}, "ansible_processor_vcpus": 4, "ansible_bios_version": "4.7.1-1.4", "ansible_processor": ["0", "GenuineIntel", "Intel(R) Xeon(R) CPU           X3470  @ 2.93GHz", "1", "GenuineIntel", "Intel(R) Xeon(R) CPU           X3470  @ 2.93GHz", "2", "GenuineIntel", "Intel(R) Xeon(R) CPU           X3470  @ 2.93GHz", "3", "GenuineIntel", "Intel(R) Xeon(R) CPU           X3470  @ 2.93GHz"], "ansible_date_time": {"weekday_number": "4", "iso8601_basic_short": "20170831T153853", "tz": "CEST", "weeknumber": "35", "hour": "15", "year": "2017", "minute": "38", "tz_offset": "+0200", "month": "08", "epoch": "1504186733", "iso8601_micro": "2017-08-31T13:38:53.730047Z", "weekday": "Thursday", "time": "15:38:53", "date": "2017-08-31", "iso8601": "2017-08-31T13:38:53Z", "day": "31", "iso8601_basic": "20170831T153853729540", "second": "53"}, "ansible_lo": {"mtu": 65536, "device": "lo", "promisc": false, "ipv4": {"broadcast": "host", "netmask": "255.0.0.0", "network": "127.0.0.0", "address": "127.0.0.1"}, "ipv6": [{"scope": "host", "prefix": "128", "address": "::1"}], "active": true, "type": "loopback"}, "ansible_memtotal_mb": 482, "ansible_ssh_host_key_ecdsa_public": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBA3piUNnJnCAiaaKBe8C42zP1+13OZ+mB9e5WWlUNeCdUGpVN6RNPHPl+X+qeOc/BL+cB8e0MDph3QJRSjNYH/w=", "ansible_ssh_host_key_ed25519_public": "AAAAC3NzaC1lZDI1NTE5AAAAIDf2/wiS2UoTp5DVxrBeB3j1eeFSj1kr5rqGyio6gvPv", "ansible_default_ipv4": {"macaddress": "1e:aa:f6:ab:6d:7f", "network": "10.16.20.0", "mtu": 1500, "broadcast": "10.16.20.255", "alias": "eth0", "netmask": "255.255.255.0", "address": "10.16.20.43", "interface": "eth0", "type": "ether", "gateway": "10.16.20.254"}, "ansible_swapfree_mb": 629, "ansible_default_ipv6": {}, "ansible_distribution_release": "stretch", "ansible_system_vendor": "Xen", "ansible_apparmor": {"status": "disabled"}, "ansible_cmdline": {"BOOT_IMAGE": "/boot/vmlinuz-4.9.0-3-amd64", "ro": true, "root": "/dev/xvda1", "quiet": true}, "ansible_effective_user_id": 1001, "ansible_mounts": [{"block_used": 437192, "uuid": "25255b15-8bd1-44db-8fe2-1b6bff2cb2ed", "size_total": 11962114048, "block_total": 2920438, "mount": "/", "block_available": 2483246, "size_available": 10171375616, "fstype": "ext4", "inode_total": 746304, "options": "rw,relatime,errors=remount-ro,data=ordered", "device": "/dev/xvda1", "inode_used": 43253, "block_size": 4096, "inode_available": 703051}], "ansible_selinux": {"status": "disabled"}, "ansible_distribution_file_parsed": true, "ansible_os_family": "Debian", "ansible_userspace_architecture": "x86_64", "ansible_product_uuid": "NA", "ansible_system": "Linux", "ansible_pkg_mgr": "apt", "ansible_memfree_mb": 15, "ansible_devices": {"sr0": {"scheduler_mode": "cfq", "rotational": "1", "vendor": "QEMU", "sectors": "2097151", "links": {"masters": [], "labels": [], "ids": ["ata-QEMU_DVD-ROM_QM00004"], "uuids": []}, "sas_device_handle": null, "sas_address": null, "virtual": 1, "host": "IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]", "sectorsize": "512", "removable": "1", "support_discard": "0", "model": "QEMU DVD-ROM", "partitions": {}, "holders": [], "size": "1024.00 MB"}, "xvda": {"scheduler_mode": "", "rotational": "0", "vendor": null, "sectors": "25165824", "links": {"masters": [], "labels": [], "ids": [], "uuids": []}, "sas_device_handle": null, "sas_address": null, "virtual": 1, "host": "", "sectorsize": "512", "removable": "0", "support_discard": "0", "model": null, "partitions": {"xvda5": {"sectorsize": 512, "uuid": "072dfa9b-a1a2-431e-b98c-019464fca0b2", "links": {"masters": [], "labels": [], "ids": [], "uuids": ["072dfa9b-a1a2-431e-b98c-019464fca0b2"]}, "sectors": "1290240", "start": "23873536", "holders": [], "size": "630.00 MB"}, "xvda1": {"sectorsize": 512, "uuid": "25255b15-8bd1-44db-8fe2-1b6bff2cb2ed", "links": {"masters": [], "labels": [], "ids": [], "uuids": ["25255b15-8bd1-44db-8fe2-1b6bff2cb2ed"]}, "sectors": "23869440", "start": "2048", "holders": [], "size": "11.38 GB"}, "xvda2": {"sectorsize": 512, "uuid": null, "links": {"masters": [], "labels": [], "ids": [], "uuids": []}, "sectors": "2", "start": "23873534", "holders": [], "size": "1.00 KB"}}, "holders": [], "size": "12.00 GB"}}, "ansible_user_uid": 1001, "ansible_memory_mb": {"real": {"total": 482, "used": 467, "free": 15}, "swap": {"cached": 0, "total": 629, "free": 629, "used": 0}, "nocache": {"used": 182, "free": 300}}, "ansible_distribution": "Debian", "ansible_user_dir": "/home/user", "ansible_env": {"LANG": "C", "TERM": "xterm-256color", "SHELL": "/bin/bash", "XDG_RUNTIME_DIR": "/run/user/1001", "MAIL": "/var/mail/user", "SHLVL": "1", "SSH_TTY": "/dev/pts/2", "SSH_CLIENT": "::1 46528 22", "PWD": "/home/user", "LOGNAME": "user", "USER": "user", "PATH": "/usr/local/bin:/usr/bin:/bin:/usr/games", "HOME": "/home/user", "SSH_CONNECTION": "::1 46528 ::1 22", "XDG_SESSION_ID": "13", "_": "/bin/sh"}, "ansible_distribution_major_version": "9", "module_setup": true, "ansible_processor_count": 4, "ansible_hostname": "stretch", "ansible_effective_group_id": 1001, "ansible_swaptotal_mb": 629, "ansible_lsb": {"release": "9.1", "major_release": "9", "codename": "stretch", "id": "Debian", "description": "Debian GNU/Linux 9.1 (stretch)"}, "ansible_real_group_id": 1001, "ansible_bios_date": "02/16/2017", "ansible_all_ipv6_addresses": ["fe80::1caa:f6ff:feab:6d7f"], "ansible_interfaces": ["lo", "eth0"], "ansible_uptime_seconds": 2474, "ansible_user_shell": "/bin/bash", "ansible_machine_id": "8adee5a4675d4211a6af77131f2f70f8", "ansible_ssh_host_key_rsa_public": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDOaR0ftNAo4F+zV8RAuCTjKw6i4vnzd01BnOz4nvf0SMqxuYrWaS2nWm9c1EmsR4hYZLfMl1S3eiw/JSnV2IZ5c7FJ+QOGS+OP8MYmN4E6lORpIQN2s0ohq7voY/p3CfL22r7tT8fzKyJrcK4yVYVPB+mw7DU6hKUmAMYumRYGsy1BwiSIwohrX6GS415n//6Er/0xLTg/o4dwf/XB4Mkj6fBA8pnoi6nxYRluQAYwfy2em0hdghZQJJOjS6tBA73ClRNAMGUH/EqNmXM6EHwF6h2lXcos49ld83q+sOpl3gbLR9J6ZErNI2wEKLOKJd0XUhEN3tFXsV/hGjnaU3a5", "ansible_user_gecos": "", "ansible_python": {"executable": "/usr/bin/python", "version": {"micro": 13, "major": 2, "releaselevel": "final", "serial": 0, "minor": 7}, "type": "CPython", "has_sslcontext": true, "version_info": [2, 7, 13, "final", 0]}, "ansible_processor_threads_per_core": 1, "ansible_fqdn": "stretch", "ansible_user_gid": 1001, "ansible_eth0": {"macaddress": "1e:aa:f6:ab:6d:7f", "pciid": "vif-0", "module": "xen_netfront", "mtu": 1500, "device": "eth0", "promisc": false, "ipv4": {"broadcast": "10.16.20.255", "netmask": "255.255.255.0", "network": "10.16.20.0", "address": "10.16.20.43"}, "ipv6": [{"scope": "link", "prefix": "64", "address": "fe80::1caa:f6ff:feab:6d7f"}], "active": true, "type": "ether"}, "ansible_python_version": "2.7.13", "ansible_product_name": "HVM domU", "ansible_machine": "x86_64", "ansible_kernel": "4.9.0-3-amd64", "ansible_nodename": "stretch"}}\r\n', 'OpenSSH_7.4p1 Debian-10+deb9u1, OpenSSL 1.0.2l  25 May 2017\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 3239\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\nShared connection to localhost closed.\r\n')

TASK [Gathering Facts] ********************************************************************************************************************************************************************************************
ok: [localhost]
META: ran handlers

TASK [role-using-with_nested-to-include : include_tasks] **********************************************************************************************************************************************************
task path: /home/user/playbook-with-role/roles/role-using-with_nested-to-include/tasks/main.yml:2
included: /home/user/playbook-with-role/roles/role-using-with_nested-to-include/tasks/first-include.yml for localhost

TASK [role-using-with_nested-to-include : debug] ******************************************************************************************************************************************************************
task path: /home/user/playbook-with-role/roles/role-using-with_nested-to-include/tasks/first-include.yml:2
ok: [localhost] => {
    "msg": "hello world"
}

TASK [role-using-with_nested-to-include : include_tasks] **********************************************************************************************************************************************************
task path: /home/user/playbook-with-role/roles/role-using-with_nested-to-include/tasks/main.yml:3
included: /home/user/playbook-with-role/roles/role-using-with_nested-to-include/tasks/second-include.yml for localhost

TASK [role-using-with_nested-to-include : debug] ******************************************************************************************************************************************************************
task path: /home/user/playbook-with-role/roles/role-using-with_nested-to-include/tasks/second-include.yml:2
ok: [localhost] => {
    "msg": "dlrow olleh"
}

TASK [role-using-with_nested-to-include : include_tasks] **********************************************************************************************************************************************************
task path: /home/user/playbook-with-role/roles/role-using-with_nested-to-include/tasks/main.yml:7
included: /home/user/playbook-with-role/roles/role-using-with_nested-to-include/tasks/third-include.yml for localhost

TASK [role-using-with_nested-to-include : debug] ******************************************************************************************************************************************************************
task path: /home/user/playbook-with-role/roles/role-using-with_nested-to-include/tasks/third-include.yml:2
ok: [localhost] => {
    "msg": "world hello"
}

TASK [role-using-with_nested-to-include : include_tasks] **********************************************************************************************************************************************************
task path: /home/user/playbook-with-role/roles/role-using-with_nested-to-include/tasks/main.yml:11
included: /home/user/playbook-with-role/roles/role-using-with_nested-to-include/tasks/fourth-include.yml for localhost
META: ran handlers
META: ran handlers

PLAY RECAP ********************************************************************************************************************************************************************************************************
localhost                  : ok=8    changed=0    unreachable=0    failed=0
jmighion commented 6 years ago

Also hitting this but not using with_nested.

jmighion commented 6 years ago

Temporary work around with allow_duplicates: true in meta/main.yml

https://docs.ansible.com/ansible/2.4/playbooks_reuse_roles.html#role-duplication-and-execution

mkrizek commented 6 years ago

@zaiyers @jmighion this seems to be fixed in the latest devel, can you try if that fixes your issue? Thanks!

needs_info

ghost commented 6 years ago

can't reproduce with newest devel. seems fixed.

thanks! :)