{"action":"closed","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/16044","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/16044/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/16044/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/16044/events","html_url":"https://github.com/ansible/ansible/issues/16044","id":157437330,"number":16044,"title":"Unexpected behavior of allow_duplicates directive in Ansible 2.1.0","user":{"login":"amitmodak","id":8802198,"avatar_url":"https://avatars.githubusercontent.com/u/8802198?v=3","gravatar_id":"","url":"https://api.github.com/users/amitmodak","html_url":"https://github.com/amitmodak","followers_url":"https://api.github.com/users/amitmodak/followers","following_url":"https://api.github.com/users/amitmodak/following{/other_user}","gists_url":"https://api.github.com/users/amitmodak/gists{/gist_id}","starred_url":"https://api.github.com/users/amitmodak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amitmodak/subscriptions","organizations_url":"https://api.github.com/users/amitmodak/orgs","repos_url":"https://api.github.com/users/amitmodak/repos","events_url":"https://api.github.com/users/amitmodak/events{/privacy}","received_events_url":"https://api.github.com/users/amitmodak/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ansible/ansible/labels/affects_2.1","name":"affects_2.1","color":"5319e7"},{"url":"https://api.github.com/repos/ansible/ansible/labels/bug_report","name":"bug_report","color":"fbca04"},{"url":"https://api.github.com/repos/ansible/ansible/labels/P2","name":"P2","color":"fad8c7"}],"state":"closed","locked":false,"assignee":{"login":"jimi-c","id":26403,"avatar_url":"https://avatars.githubusercontent.com/u/26403?v=3","gravatar_id":"","url":"https://api.github.com/users/jimi-c","html_url":"https://github.com/jimi-c","followers_url":"https://api.github.com/users/jimi-c/followers","following_url":"https://api.github.com/users/jimi-c/following{/other_user}","gists_url":"https://api.github.com/users/jimi-c/gists{/gist_id}","starred_url":"https://api.github.com/users/jimi-c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimi-c/subscriptions","organizations_url":"https://api.github.com/users/jimi-c/orgs","repos_url":"https://api.github.com/users/jimi-c/repos","events_url":"https://api.github.com/users/jimi-c/events{/privacy}","received_events_url":"https://api.github.com/users/jimi-c/received_events","type":"User","site_admin":false},"assignees":[{"login":"jimi-c","id":26403,"avatar_url":"https://avatars.githubusercontent.com/u/26403?v=3","gravatar_id":"","url":"https://api.github.com/users/jimi-c","html_url":"https://github.com/jimi-c","followers_url":"https://api.github.com/users/jimi-c/followers","following_url":"https://api.github.com/users/jimi-c/following{/other_user}","gists_url":"https://api.github.com/users/jimi-c/gists{/gist_id}","starred_url":"https://api.github.com/users/jimi-c/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimi-c/subscriptions","organizations_url":"https://api.github.com/users/jimi-c/orgs","repos_url":"https://api.github.com/users/jimi-c/repos","events_url":"https://api.github.com/users/jimi-c/events{/privacy}","received_events_url":"https://api.github.com/users/jimi-c/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/ansible/ansible/milestones/8","html_url":"https://github.com/ansible/ansible/milestones/2.2.0","labels_url":"https://api.github.com/repos/ansible/ansible/milestones/8/labels","id":1702615,"number":8,"title":"2.2.0","description":"","creator":{"login":"sivel","id":39340,"avatar_url":"https://avatars.githubusercontent.com/u/39340?v=3","gravatar_id":"","url":"https://api.github.com/users/sivel","html_url":"https://github.com/sivel","followers_url":"https://api.github.com/users/sivel/followers","following_url":"https://api.github.com/users/sivel/following{/other_user}","gists_url":"https://api.github.com/users/sivel/gists{/gist_id}","starred_url":"https://api.github.com/users/sivel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sivel/subscriptions","organizations_url":"https://api.github.com/users/sivel/orgs","repos_url":"https://api.github.com/users/sivel/repos","events_url":"https://api.github.com/users/sivel/events{/privacy}","received_events_url":"https://api.github.com/users/sivel/received_events","type":"User","site_admin":false},"open_issues":165,"closed_issues":245,"state":"open","created_at":"2016-04-12T23:10:49Z","updated_at":"2016-09-20T20:43:18Z","due_on":null,"closed_at":null},"comments":6,"created_at":"2016-05-30T06:09:32Z","updated_at":"2016-09-20T20:43:18Z","closed_at":"2016-09-20T20:43:18Z","body":"<!--- Verify first that your issue/request is not already reported in GitHub -->\r\n\r\n##### ISSUE TYPE\r\n<!--- Pick one below and delete the rest: -->\r\n - Bug Report\r\n\r\n\r\n##### ANSIBLE VERSION\r\n<!--- Paste verbatim output from “ansible --version” between quotes below -->\r\n```\r\nansible 2.1.0.0\r\n  config file = \r\n  configured module search path = Default w/o overrides\r\n```\r\n\r\n##### CONFIGURATION\r\nNone\r\n<!---\r\nMention any settings you have changed/added/removed in ansible.cfg\r\n(or using the ANSIBLE_* environment variables).\r\n-->\r\n\r\n##### OS / ENVIRONMENT\r\nN/A\r\n<!---\r\nMention the OS you are running Ansible from, and the OS you are\r\nmanaging, or say “N/A” for anything that is not platform-specific.\r\n-->\r\n\r\n##### SUMMARY\r\nIn a scenario where multiple roles depend on a single role, the dependent role is not executed multiple times in spite of setting `allow_duplicates: yes` in `meta/main.yml` of the dependent role. With Ansible 1.9.4, the dependent role does execute multiple times as expected.\r\n\r\nReference: https://github.com/ansible/ansible/issues/11707\r\n\r\n<!--- Explain the problem briefly -->\r\n\r\n##### STEPS TO REPRODUCE\r\n<!---\r\nFor bugs, show exactly how to reproduce the problem.\r\nFor new features, show how the feature would be used.\r\n-->\r\nI will try to explain the scenario with 2 roles `r1` and `r2` - both of which depend on a role `c`\r\n<!--- Paste example playbooks or commands between quotes below -->\r\n\r\n* Playbook and Inventory\r\n```\r\n$ cat playbook.yml \r\n---\r\n- name: dummy\r\n  hosts: myhosts\r\n  roles:\r\n    - role: r1\r\n      when: \"inventory_hostname == 'host1'\"\r\n    - role: r2\r\n      when: \"inventory_hostname == 'host2'\"\r\n\r\n$ cat inv \r\n[myhosts]\r\nhost1 ansible_ssh_host=127.0.0.1       ansible_connection=local\r\nhost2 ansible_ssh_host=127.0.0.1       ansible_connection=local\r\n```\r\n\r\n* Role **r1**\r\n```\r\n$ cat roles/r1/tasks/main.yml \r\n---\r\n- name: dummy1\r\n  debug:\r\n    msg: \"I am r1\"\r\n\r\n$ cat roles/r1/meta/main.yml \r\n---\r\ndependencies:\r\n  - c\r\n```\r\n\r\n* Role **r2**\r\n```\r\n$ cat roles/r2/tasks/main.yml \r\n---\r\n- name: dummy2\r\n  debug:\r\n    msg: \"I am r2\"\r\n\r\n$ cat roles/r2/meta/main.yml \r\n---\r\ndependencies:\r\n  - c\r\n```\r\n\r\n* Role **c**\r\n```\r\n$ cat roles/c/tasks/main.yml \r\n---\r\n- name: common\r\n  debug:\r\n    msg: \"I am c\"\r\n\r\n$ cat roles/c/meta/main.yml \r\n---\r\nallow_duplicates: yes\r\n```\r\n<!--- You can also paste gist.github.com links for larger files -->\r\n\r\n##### EXPECTED RESULTS\r\n<!--- What did you expect to happen when running the steps above? -->\r\nAs `allow_duplicates: yes` has been configured, the execution order should have been c *(on host1)* --> r1 *(on host1)* --> c *(on host2)* --> r2 *(on host2)*. Ansible 1.9.4 does have this execution order.\r\n\r\n###### Output with Ansible 1.9.4\r\n```\r\n$ ansible-playbook -i inv playbook.yml \r\n\r\nPLAY [dummy] ****************************************************************** \r\n\r\nGATHERING FACTS *************************************************************** \r\nok: [host1]\r\nok: [host2]\r\n\r\nTASK: [c | common] ************************************************************ \r\nskipping: [host2]\r\nok: [host1] => {\r\n    \"msg\": \"I am c\"\r\n}\r\n\r\nTASK: [r1 | dummy1] *********************************************************** \r\nskipping: [host2]\r\nok: [host1] => {\r\n    \"msg\": \"I am r1\"\r\n}\r\n\r\nTASK: [c | common] ************************************************************ \r\nskipping: [host1]\r\nok: [host2] => {\r\n    \"msg\": \"I am c\"\r\n}\r\n\r\nTASK: [r2 | dummy2] *********************************************************** \r\nskipping: [host1]\r\nok: [host2] => {\r\n    \"msg\": \"I am r2\"\r\n}\r\n\r\nPLAY RECAP ******************************************************************** \r\nhost1                      : ok=3    changed=0    unreachable=0    failed=0   \r\nhost2                      : ok=3    changed=0    unreachable=0    failed=0   \r\n```\r\n\r\n\r\n##### ACTUAL RESULTS\r\n<!--- What actually happened? If possible run with extra verbosity (-vvvv) -->\r\nc was not executed for the second time as a dependency of r2\r\n\r\n<!--- Paste verbatim command output between quotes below -->\r\n```\r\n$ ansible-playbook -i inv playbook.yml \r\n\r\nPLAY [dummy] *******************************************************************\r\n\r\nTASK [setup] *******************************************************************\r\nok: [host2]\r\nok: [host1]\r\n\r\nTASK [c : common] **************************************************************\r\nok: [host1] => {\r\n    \"msg\": \"I am c\"\r\n}\r\nskipping: [host2]\r\n\r\nTASK [r1 : dummy1] *************************************************************\r\nskipping: [host2]\r\nok: [host1] => {\r\n    \"msg\": \"I am r1\"\r\n}\r\n\r\nTASK [c : common] **************************************************************\r\nskipping: [host1]\r\nskipping: [host2]\r\n\r\nTASK [r2 : dummy2] *************************************************************\r\nskipping: [host1]\r\nok: [host2] => {\r\n    \"msg\": \"I am r2\"\r\n}\r\n\r\nPLAY RECAP *********************************************************************\r\nhost1                      : ok=3    changed=0    unreachable=0    failed=0   \r\nhost2                      : ok=2    changed=0    unreachable=0    failed=0   \r\n```\r\n"}}
{"actor":{"display_login":"jimi-c"}}