<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">core</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.4.2.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.14 (default, Jan 17 2018, 14:28:32) [GCC 7.2.1 20170915 (Red Hat 7.2.1-2)"><pre class="notranslate"><code class="notranslate">ansible 2.4.2.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.14 (default, Jan 17 2018, 14:28:32) [GCC 7.2.1 20170915 (Red Hat 7.2.1-2)
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ansible-config dump --only-changed
(no output)"><pre class="notranslate"><code class="notranslate">$ ansible-config dump --only-changed
(no output)
</code></pre></div>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">N/A</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">handlers in roles that have been loaded using <code class="notranslate">include_role</code> are not executed when used in the "conventional" way. Using <code class="notranslate">listen</code> works, though.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#!/bin/bash
tmp=$(mktemp -d)
cd &quot;${tmp}&quot;
tee ansible.cfg &lt;&lt;EOF
[defaults]
nocows = 1
force_handlers = True
EOF
mkdir -p roles/role_{import,include{,_works}}/{tasks,handlers}
tee roles/role_{import,include}/handlers/main.yml &lt;&lt;EOF
---
- name: &quot;my handler&quot;
  debug: msg=&quot;running handler in {{role_name}}&quot;
EOF
tee roles/role_{import,include{,_works}}/tasks/main.yml &lt;&lt;EOF
---
- name: &quot;do something&quot;
  command: /bin/true
  notify: my handler
EOF
tee roles/role_include_works/handlers/main.yml &lt;&lt;EOF
---
- name: &quot;my handler&quot;
  listen: ['my handler']
  debug: msg=&quot;running handler in {{role_name}}&quot;
EOF
tee run.yml &lt;&lt;EOF
---
- hosts: localhost
  gather_facts: no
  tasks:
    - import_role: name=role_import
    - include_role: name=role_include
    - include_role: name=role_include_works
EOF
ansible-playbook run.yml"><pre class="notranslate"><span class="pl-c"><span class="pl-c">#!</span>/bin/bash</span>
tmp=<span class="pl-s"><span class="pl-pds">$(</span>mktemp -d<span class="pl-pds">)</span></span>
<span class="pl-c1">cd</span> <span class="pl-s"><span class="pl-pds">"</span><span class="pl-smi">${tmp}</span><span class="pl-pds">"</span></span>
tee ansible.cfg <span class="pl-s"><span class="pl-k">&lt;&lt;</span><span class="pl-k">EOF</span></span>
<span class="pl-s">[defaults]</span>
<span class="pl-s">nocows = 1</span>
<span class="pl-s">force_handlers = True</span>
<span class="pl-s"><span class="pl-k">EOF</span></span>
mkdir -p roles/role_{import,include{,_works}}/{tasks,handlers}
tee roles/role_{import,include}/handlers/main.yml <span class="pl-s"><span class="pl-k">&lt;&lt;</span><span class="pl-k">EOF</span></span>
<span class="pl-s">---</span>
<span class="pl-s">- name: "my handler"</span>
<span class="pl-s">  debug: msg="running handler in {{role_name}}"</span>
<span class="pl-s"><span class="pl-k">EOF</span></span>
tee roles/role_{import,include{,_works}}/tasks/main.yml <span class="pl-s"><span class="pl-k">&lt;&lt;</span><span class="pl-k">EOF</span></span>
<span class="pl-s">---</span>
<span class="pl-s">- name: "do something"</span>
<span class="pl-s">  command: /bin/true</span>
<span class="pl-s">  notify: my handler</span>
<span class="pl-s"><span class="pl-k">EOF</span></span>
tee roles/role_include_works/handlers/main.yml <span class="pl-s"><span class="pl-k">&lt;&lt;</span><span class="pl-k">EOF</span></span>
<span class="pl-s">---</span>
<span class="pl-s">- name: "my handler"</span>
<span class="pl-s">  listen: ['my handler']</span>
<span class="pl-s">  debug: msg="running handler in {{role_name}}"</span>
<span class="pl-s"><span class="pl-k">EOF</span></span>
tee run.yml <span class="pl-s"><span class="pl-k">&lt;&lt;</span><span class="pl-k">EOF</span></span>
<span class="pl-s">---</span>
<span class="pl-s">- hosts: localhost</span>
<span class="pl-s">  gather_facts: no</span>
<span class="pl-s">  tasks:</span>
<span class="pl-s">    - import_role: name=role_import</span>
<span class="pl-s">    - include_role: name=role_include</span>
<span class="pl-s">    - include_role: name=role_include_works</span>
<span class="pl-s"><span class="pl-k">EOF</span></span>
ansible-playbook run.yml</pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
TASK [role_import : do something] *****************************************************************
changed: [localhost]

TASK [include_role] *******************************************************************************

TASK [role_include : do something] ****************************************************************
changed: [localhost]

TASK [include_role] *******************************************************************************

TASK [role_include_works : do something] **********************************************************
changed: [localhost]

RUNNING HANDLER [role_import : my handler] ********************************************************
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;running handler in role_import&quot;
}

RUNNING HANDLER [role_include : my handler] ********************************************************
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;running handler in role_include&quot;
}

RUNNING HANDLER [role_include_works : my handler] *************************************************
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;running handler in role_include_works&quot;
}

PLAY RECAP ****************************************************************************************
localhost                  : ok=5    changed=3    unreachable=0    failed=0   "><pre lang="PLAY" class="notranslate"><code class="notranslate">
TASK [role_import : do something] *****************************************************************
changed: [localhost]

TASK [include_role] *******************************************************************************

TASK [role_include : do something] ****************************************************************
changed: [localhost]

TASK [include_role] *******************************************************************************

TASK [role_include_works : do something] **********************************************************
changed: [localhost]

RUNNING HANDLER [role_import : my handler] ********************************************************
ok: [localhost] =&gt; {
    "msg": "running handler in role_import"
}

RUNNING HANDLER [role_include : my handler] ********************************************************
ok: [localhost] =&gt; {
    "msg": "running handler in role_include"
}

RUNNING HANDLER [role_include_works : my handler] *************************************************
ok: [localhost] =&gt; {
    "msg": "running handler in role_include_works"
}

PLAY RECAP ****************************************************************************************
localhost                  : ok=5    changed=3    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 [role_import : do something] *****************************************************************
changed: [localhost]

TASK [include_role] *******************************************************************************

TASK [role_include : do something] ****************************************************************
changed: [localhost]

TASK [include_role] *******************************************************************************

TASK [role_include_works : do something] **********************************************************
changed: [localhost]

RUNNING HANDLER [role_import : my handler] ********************************************************
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;running handler in role_import&quot;
}

RUNNING HANDLER [role_include_works : my handler] *************************************************
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;running handler in role_include_works&quot;
}

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

TASK [role_import : do something] *****************************************************************
changed: [localhost]

TASK [include_role] *******************************************************************************

TASK [role_include : do something] ****************************************************************
changed: [localhost]

TASK [include_role] *******************************************************************************

TASK [role_include_works : do something] **********************************************************
changed: [localhost]

RUNNING HANDLER [role_import : my handler] ********************************************************
ok: [localhost] =&gt; {
    "msg": "running handler in role_import"
}

RUNNING HANDLER [role_include_works : my handler] *************************************************
ok: [localhost] =&gt; {
    "msg": "running handler in role_include_works"
}

PLAY RECAP ****************************************************************************************
localhost                  : ok=5    changed=3    unreachable=0    failed=0   
</code></pre></div>
<h5 dir="auto">Issue Type:</h5>
<p dir="auto">Bug report.</p>
<h5 dir="auto">Ansible Version:</h5>
<p dir="auto">1.5.5</p>
<h5 dir="auto">Environment:</h5>
<ul dir="auto">
<li>Workstation: Archlinux</li>
<li>Managed host(s): CentOS 6.5, Ubuntu 12.04, Archlinux, ...</li>
</ul>
<h5 dir="auto">Summary:</h5>
<p dir="auto">Follow up for <a href="https://github.com/ansible/ansible/issues/6443" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible/issues/6443/hovercard">#6443</a> and <a href="https://github.com/ansible/ansible/issues/6499" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible/issues/6499/hovercard">#6499</a>.</p>
<p dir="auto">Using git module with</p>
<ul dir="auto">
<li>sudo: yes</li>
<li>sudo_user: some_user</li>
</ul>
<p dir="auto">results in Python os.stat error when <em>ansible_ssh_user</em> remote hosts<br>
$HOME directory was created with umask 0077 resulting in 0700 directory<br>
permissions of /home/<em>ansible_ssh_user</em>.</p>
<p dir="auto">Cloning a repository using SSH or HTTP as transport layer. Connecting<br>
to the managed node with -c local or SSH.</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 -c local -vvvv /path/to/playbook.yml"><pre class="notranslate"><code class="notranslate">$ ansible-playbook -c local -vvvv /path/to/playbook.yml
</code></pre></div>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
---
- hosts: localhost
  sudo: yes
  sudo_user: root
  vars:
    - git_user_name: foobar
    - git_user_home: /tmp/{{ git_user_name }}
    - git_clone_repo: https://github.com/ansible/ansible
  tasks:
    - name: Ensure ansible_ssh_user home directory permissions
      file:
        state=directory
        mode=0700
        dest={{ ansible_env['PWD'] }}

    - name: Create Git user
      user:
        name={{ git_user_name }}
        home={{ git_user_home }}
        shell=/bin/bash

    - name: Clone Git repository
      sudo: yes
      sudo_user: &quot;{{ git_user_name }}&quot;
      git:
        repo={{ git_clone_repo }}
        dest={{ git_user_home }}/clone_me_some_repo_for_great_good
        force=yes
        remote=origin"><pre class="notranslate"><code class="notranslate">
---
- hosts: localhost
  sudo: yes
  sudo_user: root
  vars:
    - git_user_name: foobar
    - git_user_home: /tmp/{{ git_user_name }}
    - git_clone_repo: https://github.com/ansible/ansible
  tasks:
    - name: Ensure ansible_ssh_user home directory permissions
      file:
        state=directory
        mode=0700
        dest={{ ansible_env['PWD'] }}

    - name: Create Git user
      user:
        name={{ git_user_name }}
        home={{ git_user_home }}
        shell=/bin/bash

    - name: Clone Git repository
      sudo: yes
      sudo_user: "{{ git_user_name }}"
      git:
        repo={{ git_clone_repo }}
        dest={{ git_user_home }}/clone_me_some_repo_for_great_good
        force=yes
        remote=origin
</code></pre></div>
<p dir="auto">Cleaning up:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ sudo userdel --remove foobar
$ sudo rm -rf /tmp/foobar"><pre class="notranslate"><code class="notranslate">$ sudo userdel --remove foobar
$ sudo rm -rf /tmp/foobar
</code></pre></div>
<h5 dir="auto">Expected Results:</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ sudo -i
$ [ -d /tmp/foobar/clone_me_some_repo_for_great_good/.git ]
$ echo $?
0"><pre class="notranslate"><code class="notranslate">$ sudo -i
$ [ -d /tmp/foobar/clone_me_some_repo_for_great_good/.git ]
$ echo $?
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="ANSIBLE_NOCOWS=1 ansible-playbook -c local -vvvv /tmp/github-bug-report/playbook.yml

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

GATHERING FACTS *************************************************************** 
&lt;localhost&gt; REMOTE_MODULE setup
&lt;localhost&gt; EXEC ['/bin/sh', '-c', 'mkdir -p /tmp/ansible/ssh_user/ansible-tmp-1398244809.55-224144278976826 &amp;&amp; chmod a+rx /tmp/ansible/ssh_user/ansible-tmp-1398244809.55-224144278976826 &amp;&amp; echo /tmp/ansible/ssh_user/ansible-tmp-1398244809.55-224144278976826']
&lt;localhost&gt; PUT /tmp/tmpUyGh5T TO /tmp/ansible/ssh_user/ansible-tmp-1398244809.55-224144278976826/setup
&lt;localhost&gt; EXEC /bin/sh -c 'sudo -k &amp;&amp; sudo -H -S -p &quot;[sudo via ansible, key=smqkhnaznohkkoqjrgsrlghissfvtnau] password: &quot; -u root /bin/sh -c '&quot;'&quot;'echo SUDO-SUCCESS-smqkhnaznohkkoqjrgsrlghissfvtnau; /usr/bin/python2 /tmp/ansible/ssh_user/ansible-tmp-1398244809.55-224144278976826/setup; rm -rf /tmp/ansible/ssh_user/ansible-tmp-1398244809.55-224144278976826/ &gt;/dev/null 2&gt;&amp;1'&quot;'&quot;''
ok: [localhost]

TASK: [Ensure ansible_ssh_user home directory permissions] ******************** 
&lt;localhost&gt; REMOTE_MODULE file state=directory mode=0700 dest=/home/ssh_user
&lt;localhost&gt; EXEC ['/bin/sh', '-c', 'mkdir -p /tmp/ansible/ssh_user/ansible-tmp-1398244809.76-13206589431477 &amp;&amp; chmod a+rx /tmp/ansible/ssh_user/ansible-tmp-1398244809.76-13206589431477 &amp;&amp; echo /tmp/ansible/ssh_user/ansible-tmp-1398244809.76-13206589431477']
&lt;localhost&gt; PUT /tmp/tmpiyGv99 TO /tmp/ansible/ssh_user/ansible-tmp-1398244809.76-13206589431477/file
&lt;localhost&gt; EXEC /bin/sh -c 'sudo -k &amp;&amp; sudo -H -S -p &quot;[sudo via ansible, key=dpmuynuqcjjmfyvfumzbeldutfblhhsq] password: &quot; -u root /bin/sh -c '&quot;'&quot;'echo SUDO-SUCCESS-dpmuynuqcjjmfyvfumzbeldutfblhhsq; /usr/bin/python2 /tmp/ansible/ssh_user/ansible-tmp-1398244809.76-13206589431477/file; rm -rf /tmp/ansible/ssh_user/ansible-tmp-1398244809.76-13206589431477/ &gt;/dev/null 2&gt;&amp;1'&quot;'&quot;''
ok: [localhost] =&gt; {&quot;changed&quot;: false, &quot;gid&quot;: 100, &quot;group&quot;: &quot;users&quot;, &quot;mode&quot;: &quot;0700&quot;, &quot;owner&quot;: &quot;ssh_user&quot;, &quot;path&quot;: &quot;/home/ssh_user&quot;, &quot;size&quot;: 956, &quot;state&quot;: &quot;directory&quot;, &quot;uid&quot;: 1042}

TASK: [Create Git user] ******************************************************* 
&lt;localhost&gt; REMOTE_MODULE user name=foobar home=/tmp/foobar shell=/bin/bash
&lt;localhost&gt; EXEC ['/bin/sh', '-c', 'mkdir -p /tmp/ansible/ssh_user/ansible-tmp-1398244809.83-38414991496750 &amp;&amp; chmod a+rx /tmp/ansible/ssh_user/ansible-tmp-1398244809.83-38414991496750 &amp;&amp; echo /tmp/ansible/ssh_user/ansible-tmp-1398244809.83-38414991496750']
&lt;localhost&gt; PUT /tmp/tmpdiz_cO TO /tmp/ansible/ssh_user/ansible-tmp-1398244809.83-38414991496750/user
&lt;localhost&gt; EXEC /bin/sh -c 'sudo -k &amp;&amp; sudo -H -S -p &quot;[sudo via ansible, key=lwvqzyalydhiquyjktyqonjclueegsut] password: &quot; -u root /bin/sh -c '&quot;'&quot;'echo SUDO-SUCCESS-lwvqzyalydhiquyjktyqonjclueegsut; /usr/bin/python2 /tmp/ansible/ssh_user/ansible-tmp-1398244809.83-38414991496750/user; rm -rf /tmp/ansible/ssh_user/ansible-tmp-1398244809.83-38414991496750/ &gt;/dev/null 2&gt;&amp;1'&quot;'&quot;''
ok: [localhost] =&gt; {&quot;append&quot;: false, &quot;changed&quot;: false, &quot;comment&quot;: &quot;&quot;, &quot;group&quot;: 1043, &quot;home&quot;: &quot;/tmp/foobar&quot;, &quot;move_home&quot;: false, &quot;name&quot;: &quot;foobar&quot;, &quot;shell&quot;: &quot;/bin/bash&quot;, &quot;state&quot;: &quot;present&quot;, &quot;uid&quot;: 1043}

TASK: [Clone Git repository] ************************************************** 
&lt;localhost&gt; REMOTE_MODULE git repo=https://github.com/ansible/ansible dest=/tmp/foobar/clone_me_some_repo_for_great_good force=yes remote=origin
&lt;localhost&gt; EXEC ['/bin/sh', '-c', 'mkdir -p /tmp/ansible-tmp-1398244809.91-40810594643527 &amp;&amp; chmod a+rx /tmp/ansible-tmp-1398244809.91-40810594643527 &amp;&amp; echo /tmp/ansible-tmp-1398244809.91-40810594643527']
&lt;localhost&gt; PUT /tmp/tmpV7Dqnb TO /tmp/ansible-tmp-1398244809.91-40810594643527/git
&lt;localhost&gt; EXEC ['/bin/sh', '-c', 'chmod a+r /tmp/ansible-tmp-1398244809.91-40810594643527/git']
&lt;localhost&gt; EXEC /bin/sh -c 'sudo -k &amp;&amp; sudo -H -S -p &quot;[sudo via ansible, key=uofualorxsuihhxfftcbklsehewekjop] password: &quot; -u foobar /bin/sh -c '&quot;'&quot;'echo SUDO-SUCCESS-uofualorxsuihhxfftcbklsehewekjop; /usr/bin/python2 /tmp/ansible-tmp-1398244809.91-40810594643527/git'&quot;'&quot;''
&lt;localhost&gt; EXEC ['/bin/sh', '-c', 'rm -rf /tmp/ansible-tmp-1398244809.91-40810594643527/ &gt;/dev/null 2&gt;&amp;1']
failed: [localhost] =&gt; {&quot;cmd&quot;: [&quot;/usr/bin/git&quot;, &quot;ls-remote&quot;, &quot;https://github.com/ansible/ansible&quot;, &quot;-h&quot;, &quot;refs/heads/HEAD&quot;], &quot;failed&quot;: true, &quot;rc&quot;: 128}
stderr: fatal: failed to stat '.': Permission denied

msg: fatal: failed to stat '.': Permission denied

FATAL: all hosts have already failed -- aborting

PLAY RECAP ******************************************************************** 
           to retry, use: --limit @/home/ssh_user/playbook.retry

localhost                  : ok=3    changed=0    unreachable=0    failed=1   

[1]    6514 exit 2     ANSIBLE_NOCOWS=1 ansible-playbook -c local -vvvv "><pre class="notranslate"><code class="notranslate">ANSIBLE_NOCOWS=1 ansible-playbook -c local -vvvv /tmp/github-bug-report/playbook.yml

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

GATHERING FACTS *************************************************************** 
&lt;localhost&gt; REMOTE_MODULE setup
&lt;localhost&gt; EXEC ['/bin/sh', '-c', 'mkdir -p /tmp/ansible/ssh_user/ansible-tmp-1398244809.55-224144278976826 &amp;&amp; chmod a+rx /tmp/ansible/ssh_user/ansible-tmp-1398244809.55-224144278976826 &amp;&amp; echo /tmp/ansible/ssh_user/ansible-tmp-1398244809.55-224144278976826']
&lt;localhost&gt; PUT /tmp/tmpUyGh5T TO /tmp/ansible/ssh_user/ansible-tmp-1398244809.55-224144278976826/setup
&lt;localhost&gt; EXEC /bin/sh -c 'sudo -k &amp;&amp; sudo -H -S -p "[sudo via ansible, key=smqkhnaznohkkoqjrgsrlghissfvtnau] password: " -u root /bin/sh -c '"'"'echo SUDO-SUCCESS-smqkhnaznohkkoqjrgsrlghissfvtnau; /usr/bin/python2 /tmp/ansible/ssh_user/ansible-tmp-1398244809.55-224144278976826/setup; rm -rf /tmp/ansible/ssh_user/ansible-tmp-1398244809.55-224144278976826/ &gt;/dev/null 2&gt;&amp;1'"'"''
ok: [localhost]

TASK: [Ensure ansible_ssh_user home directory permissions] ******************** 
&lt;localhost&gt; REMOTE_MODULE file state=directory mode=0700 dest=/home/ssh_user
&lt;localhost&gt; EXEC ['/bin/sh', '-c', 'mkdir -p /tmp/ansible/ssh_user/ansible-tmp-1398244809.76-13206589431477 &amp;&amp; chmod a+rx /tmp/ansible/ssh_user/ansible-tmp-1398244809.76-13206589431477 &amp;&amp; echo /tmp/ansible/ssh_user/ansible-tmp-1398244809.76-13206589431477']
&lt;localhost&gt; PUT /tmp/tmpiyGv99 TO /tmp/ansible/ssh_user/ansible-tmp-1398244809.76-13206589431477/file
&lt;localhost&gt; EXEC /bin/sh -c 'sudo -k &amp;&amp; sudo -H -S -p "[sudo via ansible, key=dpmuynuqcjjmfyvfumzbeldutfblhhsq] password: " -u root /bin/sh -c '"'"'echo SUDO-SUCCESS-dpmuynuqcjjmfyvfumzbeldutfblhhsq; /usr/bin/python2 /tmp/ansible/ssh_user/ansible-tmp-1398244809.76-13206589431477/file; rm -rf /tmp/ansible/ssh_user/ansible-tmp-1398244809.76-13206589431477/ &gt;/dev/null 2&gt;&amp;1'"'"''
ok: [localhost] =&gt; {"changed": false, "gid": 100, "group": "users", "mode": "0700", "owner": "ssh_user", "path": "/home/ssh_user", "size": 956, "state": "directory", "uid": 1042}

TASK: [Create Git user] ******************************************************* 
&lt;localhost&gt; REMOTE_MODULE user name=foobar home=/tmp/foobar shell=/bin/bash
&lt;localhost&gt; EXEC ['/bin/sh', '-c', 'mkdir -p /tmp/ansible/ssh_user/ansible-tmp-1398244809.83-38414991496750 &amp;&amp; chmod a+rx /tmp/ansible/ssh_user/ansible-tmp-1398244809.83-38414991496750 &amp;&amp; echo /tmp/ansible/ssh_user/ansible-tmp-1398244809.83-38414991496750']
&lt;localhost&gt; PUT /tmp/tmpdiz_cO TO /tmp/ansible/ssh_user/ansible-tmp-1398244809.83-38414991496750/user
&lt;localhost&gt; EXEC /bin/sh -c 'sudo -k &amp;&amp; sudo -H -S -p "[sudo via ansible, key=lwvqzyalydhiquyjktyqonjclueegsut] password: " -u root /bin/sh -c '"'"'echo SUDO-SUCCESS-lwvqzyalydhiquyjktyqonjclueegsut; /usr/bin/python2 /tmp/ansible/ssh_user/ansible-tmp-1398244809.83-38414991496750/user; rm -rf /tmp/ansible/ssh_user/ansible-tmp-1398244809.83-38414991496750/ &gt;/dev/null 2&gt;&amp;1'"'"''
ok: [localhost] =&gt; {"append": false, "changed": false, "comment": "", "group": 1043, "home": "/tmp/foobar", "move_home": false, "name": "foobar", "shell": "/bin/bash", "state": "present", "uid": 1043}

TASK: [Clone Git repository] ************************************************** 
&lt;localhost&gt; REMOTE_MODULE git repo=https://github.com/ansible/ansible dest=/tmp/foobar/clone_me_some_repo_for_great_good force=yes remote=origin
&lt;localhost&gt; EXEC ['/bin/sh', '-c', 'mkdir -p /tmp/ansible-tmp-1398244809.91-40810594643527 &amp;&amp; chmod a+rx /tmp/ansible-tmp-1398244809.91-40810594643527 &amp;&amp; echo /tmp/ansible-tmp-1398244809.91-40810594643527']
&lt;localhost&gt; PUT /tmp/tmpV7Dqnb TO /tmp/ansible-tmp-1398244809.91-40810594643527/git
&lt;localhost&gt; EXEC ['/bin/sh', '-c', 'chmod a+r /tmp/ansible-tmp-1398244809.91-40810594643527/git']
&lt;localhost&gt; EXEC /bin/sh -c 'sudo -k &amp;&amp; sudo -H -S -p "[sudo via ansible, key=uofualorxsuihhxfftcbklsehewekjop] password: " -u foobar /bin/sh -c '"'"'echo SUDO-SUCCESS-uofualorxsuihhxfftcbklsehewekjop; /usr/bin/python2 /tmp/ansible-tmp-1398244809.91-40810594643527/git'"'"''
&lt;localhost&gt; EXEC ['/bin/sh', '-c', 'rm -rf /tmp/ansible-tmp-1398244809.91-40810594643527/ &gt;/dev/null 2&gt;&amp;1']
failed: [localhost] =&gt; {"cmd": ["/usr/bin/git", "ls-remote", "https://github.com/ansible/ansible", "-h", "refs/heads/HEAD"], "failed": true, "rc": 128}
stderr: fatal: failed to stat '.': Permission denied

msg: fatal: failed to stat '.': Permission denied

FATAL: all hosts have already failed -- aborting

PLAY RECAP ******************************************************************** 
           to retry, use: --limit @/home/ssh_user/playbook.retry

localhost                  : ok=3    changed=0    unreachable=0    failed=1   

[1]    6514 exit 2     ANSIBLE_NOCOWS=1 ansible-playbook -c local -vvvv 
</code></pre></div>