<h5 dir="auto">ISSUE TYPE</h5>

<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>

<p dir="auto">Ansible play-book randomly fails with error message ERROR[Timeout (12s) waiting for privilege escalation prompt: ]</p>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Ansible version: 2.3"><pre class="notranslate"><code class="notranslate">Ansible version: 2.3
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

<p dir="auto">[defaults]<br>
inventory = ./hosts<br>
log_path = /dev/null<br>
remote_user = ansible<br>
host_key_checking = False<br>
retry_files_enabled = False</p>
<p dir="auto">[ssh_connection]<br>
pipelining = True<br>
ssh_args = -o ControlMaster=auto -o ControlPersist=30m -o UserKnownHostsFile=/dev/null</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>

<p dir="auto">DISTRIB_ID=Ubuntu<br>
DISTRIB_RELEASE=16.04<br>
DISTRIB_CODENAME=xenial<br>
DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS"</p>
<h5 dir="auto">SUMMARY</h5>

<p dir="auto">ansible runs in our environment every hour and randomly on different hosts we get Timeout (12s) waiting for privilege escalation prompt, I have repeated the test on the environment which all hosts where on local network and I saw the exact error.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>


<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content=""><pre class="notranslate"></pre></div>

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

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


<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=""><pre class="notranslate"><code class="notranslate">
</code></pre></div>
<h5 dir="auto">Issue Type:</h5>
<p dir="auto">Bug Report</p>
<h5 dir="auto">Ansible Version:</h5>
<p dir="auto">ansible 1.9.2<br>
configured module search path = None</p>
<h5 dir="auto">Environment:</h5>
<p dir="auto">Arch Linux</p>
<h5 dir="auto">Summary:</h5>
<p dir="auto">Taken from my Post here: <a href="https://groups.google.com/forum/#!topic/ansible-project/lsFr9tAUdUE" rel="nofollow">https://groups.google.com/forum/#!topic/ansible-project/lsFr9tAUdUE</a><br>
Yesterday i took another try on the role dependency feature and realize that this doesn't work as i expect this as the dependencies are not multiple executed with the "allow_duplicates: yes" feature enabled and also not executed when i use Tags on the roles.</p>
<h5 dir="auto">Steps To Reproduce:</h5>
<p dir="auto">I try to explain what i mean with an sample playbook/roles:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ cat play-test.yml

---
- name: dependency test
  gather_facts: false
  hosts: localhost

  roles:
    - { role: feature1 }
    - { role: feature2 }

$ cat roles/feature1/tasks/main.yml

---
- name: in feature1
  debug: msg=&quot;here we are in feature1&quot;

$ cat roles/feature1/meta/main.yml

---
allow_duplicates: yes
dependencies:
  - { role: base }

$ cat roles/feature2/tasks/main.yml

---
- name: in feature2
  debug: msg=&quot;here we are in feature2&quot;

$ cat roles/feature2/meta/main.yml

---
allow_duplicates: yes
dependencies:
  - { role: base }

$ cat roles/base/tasks/main.yml

---
- name: in base
  debug: msg=&quot;here we are in base&quot;"><pre class="notranslate"><code class="notranslate">$ cat play-test.yml

---
- name: dependency test
  gather_facts: false
  hosts: localhost

  roles:
    - { role: feature1 }
    - { role: feature2 }

$ cat roles/feature1/tasks/main.yml

---
- name: in feature1
  debug: msg="here we are in feature1"

$ cat roles/feature1/meta/main.yml

---
allow_duplicates: yes
dependencies:
  - { role: base }

$ cat roles/feature2/tasks/main.yml

---
- name: in feature2
  debug: msg="here we are in feature2"

$ cat roles/feature2/meta/main.yml

---
allow_duplicates: yes
dependencies:
  - { role: base }

$ cat roles/base/tasks/main.yml

---
- name: in base
  debug: msg="here we are in base"
</code></pre></div>
<p dir="auto">I would expect because of the allow_duplicates: yes that the basic role is executed twice but that doesn't happen:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ansible-playbook play-test.yml

PLAY [dependency test] ********************************************************

TASK: [base | in base] ********************************************************
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;here we are in base&quot;
}

TASK: [feature1 | in feature1] ************************************************
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;here we are in feature1&quot;
}

TASK: [feature2 | in feature2] ************************************************
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;here we are in feature2&quot;
}

PLAY RECAP ********************************************************************
localhost                  : ok=3    changed=0    unreachable=0    failed=0"><pre class="notranslate"><code class="notranslate">$ ansible-playbook play-test.yml

PLAY [dependency test] ********************************************************

TASK: [base | in base] ********************************************************
ok: [localhost] =&gt; {
    "msg": "here we are in base"
}

TASK: [feature1 | in feature1] ************************************************
ok: [localhost] =&gt; {
    "msg": "here we are in feature1"
}

TASK: [feature2 | in feature2] ************************************************
ok: [localhost] =&gt; {
    "msg": "here we are in feature2"
}

PLAY RECAP ********************************************************************
localhost                  : ok=3    changed=0    unreachable=0    failed=0
</code></pre></div>
<p dir="auto">After that I extend the example with another pice named tags:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ cat play-test.yml

---
- name: dependency test
  gather_facts: false
  hosts: localhost

  roles:
    - { role: feature1, tags: feature1 }
    - { role: feature2, tags: feature2 }"><pre class="notranslate"><code class="notranslate">$ cat play-test.yml

---
- name: dependency test
  gather_facts: false
  hosts: localhost

  roles:
    - { role: feature1, tags: feature1 }
    - { role: feature2, tags: feature2 }
</code></pre></div>
<p dir="auto">This gives me another strage behavior if you look at the following output (i used --list-tags for simplicity):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ansible-playbook play-test.yml --list-tasks

playbook: play-test.yml

  play #1 (dependency test):    TAGS: []
    in base TAGS: [feature1]
    in feature1 TAGS: [feature1]
    in feature2 TAGS: [feature2]"><pre class="notranslate"><code class="notranslate">$ ansible-playbook play-test.yml --list-tasks

playbook: play-test.yml

  play #1 (dependency test):    TAGS: []
    in base TAGS: [feature1]
    in feature1 TAGS: [feature1]
    in feature2 TAGS: [feature2]
</code></pre></div>
<p dir="auto">As there is still "allow_duplicates: yes" active, i would expect the execution of base 2 times.<br>
So i try the following (as this is my initial intention to use role dependencys and tags):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ansible-playbook play-test.yml --list-tasks -t feature1

playbook: play-test.yml

  play #1 (dependency test):    TAGS: []
    in base TAGS: [feature1]
    in feature1 TAGS: [feature1]"><pre class="notranslate"><code class="notranslate">$ ansible-playbook play-test.yml --list-tasks -t feature1

playbook: play-test.yml

  play #1 (dependency test):    TAGS: []
    in base TAGS: [feature1]
    in feature1 TAGS: [feature1]
</code></pre></div>
<p dir="auto">Looks OK to me, but then:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ansible-playbook play-test.yml --list-tasks -t feature2

playbook: play-test.yml

  play #1 (dependency test):    TAGS: []
    in feature2 TAGS: [feature2]"><pre class="notranslate"><code class="notranslate">$ ansible-playbook play-test.yml --list-tasks -t feature2

playbook: play-test.yml

  play #1 (dependency test):    TAGS: []
    in feature2 TAGS: [feature2]
</code></pre></div>
<p dir="auto">So in the second try the base role isn't run at all.<br>
This is definitely not the expected behavior. In the role "feature2" the dependency is set to the "basic" role and in my eyes if i specify an role with an tag the dependency should run (like the first one).</p>
<p dir="auto">Did i miss something?</p>
<p dir="auto">BTW: This is the inverse behavior as i realized in this bug: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="49353641" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible/issues/9578" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible/issues/9578/hovercard" href="https://github.com/ansible/ansible/issues/9578">#9578</a><br>
This was closed with:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="this is expected, the 'no duplicates' is not just on role name but on the role 'signature' so by passing different tags you make them 'differnt roles'.&quot;"><pre class="notranslate"><code class="notranslate">this is expected, the 'no duplicates' is not just on role name but on the role 'signature' so by passing different tags you make them 'differnt roles'."
</code></pre></div>
<p dir="auto">It seems that this breaks on the way from 1.7.2 to 1.9.2</p>
<p dir="auto">All in all i'm really confused about the actual behavior with the meta - dependency stuff and the tags stuff.</p>
<p dir="auto">In the docs the Tags feature is described with "If you have a large playbook it may become useful to be able to run a specific part of the configuration without running the whole playbook."<br>
But when someone try to use it together with the dependency feature this is broken.</p>
<ul dir="auto">
<li>the old behavior is to run the dependency for every Tag Keyword (witch it is not what i expect from the combination)</li>
<li>actually the dependency is only run once on the first role defined in playbook which depends on the role</li>
</ul>