title: Ansible role of duplicate works for the absolute parameters only
body: <p>I have playbook like this </p>
  
  <pre><code>test_playbook/
  ├── dep_test.yaml
  ├── my_hosts_file
  └── roles
      ├── common
      │   └── vars
      │       └── main.yaml
      ├── dep_test
      │   ├── meta
      │   │   └── main.yaml
      │   └── tasks
      │       └── main.yaml
      ├── dep_test_a
      │   └── tasks
      │       └── main.yaml
      └── dep_test_b
          ├── meta
          │   └── main.yaml
          └── tasks
              └── main.yaml
  </code></pre>
  
  <p>Files content are as below.</p>
  
  <p><strong>dep_test.yaml</strong></p>
  
  <pre><code>- hosts: my_host
    gather_facts: no
    roles:
        - common
        - dep_test
  </code></pre>
  
  <p><strong>my_hosts_file</strong></p>
  
  <pre><code>[my_host]
  localhost
  </code></pre>
  
  <p><strong>roles/common/vars/main.yaml</strong></p>
  
  <pre><code>python_version: "3"
  </code></pre>
  
  <p><strong>roles/dep_test/tasks/main.yaml</strong></p>
  
  <pre><code>- name: debug test
    debug:
        msg: test debug
  </code></pre>
  
  <p><strong>roles/dep_test/meta/main.yaml</strong></p>
  
  <pre><code>dependencies:
      - role: dep_test_a
  #     pyenv_versions: ["{{ python_version }}"]
        pyenv_versions: ["3"]
      - role: dep_test_b
  #     python_versions: ["{{ python_version }}"]
        python_versions: ["3"]
  </code></pre>
  
  <p><strong>roles/dep_test_a/tasks/main.yaml</strong></p>
  
  <pre><code>- name: Dep test a
    debug:
        msg: "Dependency test a called with {{ pyenv_versions }}"
  </code></pre>
  
  <p><strong>roles/dep_test_b/tasks/main.yaml</strong></p>
  
  <pre><code>- name: Dep test b
    debug:
        msg: "Dependency test b called with {{ python_versions }}"
  </code></pre>
  
  <p><strong>roles/dep_test_b/meta/main.yaml</strong></p>
  
  <pre><code>dependencies:
      - role: dep_test_a
  #     pyenv_versions: "{{ python_versions }}"
        pyenv_versions: ["3"]
  </code></pre>
  
  <p>When I pass parameter as <code>["3"]</code> it works fine and apply the <a href="http://docs.ansible.com/ansible/latest/user_guide/playbooks_reuse_roles.html#role-duplication-and-execution" rel="nofollow noreferrer">Role Duplication and Execution</a></p>
  
  <pre><code>ansible-playbook dep_test.yaml -i my_hosts_file -u root --ask-pass
  SSH password:
  
  PLAY [my_host] ****************************************************************************************************
  
  TASK [dep_test_a : Dep test a] ************************************************************************************
  ok: [localhost] =&gt; {
      "msg": "Dependency test a called with [u'3']"
  }
  
  TASK [dep_test_b : Dep test b] ************************************************************************************
  ok: [localhost] =&gt; {
      "msg": "Dependency test b called with [u'3']"
  }
  
  TASK [dep_test : debug test] **************************************************************************************
  ok: [localhost] =&gt; {
      "msg": "test debug"
  }
  
  PLAY RECAP ********************************************************************************************************
  localhost                  : ok=3    changed=0    unreachable=0    failed=0
  </code></pre>
  
  <p>When I change the parameter from <code>["3"]</code> to use the variable form <code>common/vars/main.yaml</code>'s <code>python_version</code>, it fail the <code>Duplication rule</code> and execute same role with duplicate arguments.</p>
  
  <p>After change code would be </p>
  
  <p><strong>roles/dep_test/meta/main.yaml</strong></p>
  
  <pre><code>dependencies:
      - role: dep_test_a
        pyenv_versions: ["{{ python_version }}"]
  #     pyenv_versions: ["3"]
      - role: dep_test_b
        python_versions: ["{{ python_version }}"]
  #     python_versions: ["3"]
  </code></pre>
  
  <p><strong>roles/dep_test_b/meta/main.yaml</strong></p>
  
  <pre><code>dependencies:
      - role: dep_test_a
        pyenv_versions: "{{ python_versions }}"
  #     pyenv_versions: ["3"]
  </code></pre>
  
  <p>Playbook execution output.</p>
  
  <pre><code>ansible-playbook dep_test.yaml -i my_hosts_file -u root --ask-pass
  SSH password:
  
  PLAY [my_host] ****************************************************************************************************
  
  TASK [dep_test_a : Dep test a] ***********************************************************************************
  ok: [localhost] =&gt; {
      "msg": "Dependency test a called with [u'3']"
  }
  
  TASK [dep_test_a : Dep test a] ************************************************************************************
  ok: [localhost] =&gt; {
      "msg": "Dependency test a called with [u'3']"
  }
  
  TASK [dep_test_b : Dep test b] ************************************************************************************
  ok: [localhost] =&gt; {
      "msg": "Dependency test b called with [u'3']"
  }
  
  TASK [dep_test : debug test] **************************************************************************************
  ok: [localhost] =&gt; {
      "msg": "test debug"
  }
  
  PLAY RECAP ********************************************************************************************************
  localhost                  : ok=4    changed=0    unreachable=0    failed=0
  </code></pre>
  
  <p>Role <code>dep_test_a</code> called 2 times with same arguments <code>[u'3']</code></p>
  
  <pre><code>TASK [dep_test_a : Dep test a] ***********************************************************************************
  
  ok: [localhost] =&gt; {
      "msg": "Dependency test a called with [u'3']"
  }
  
  TASK [dep_test_a : Dep test a] ************************************************************************************
  ok: [localhost] =&gt; {
      "msg": "Dependency test a called with [u'3']"
  }
  </code></pre>
  
  <p>One for the dependencies in <code>dep_test</code> role and another for <code>dep_test_b</code>.</p>
  
  <p>As per the rule of dependencies, this should be called only once.</p>
  
  <p>Question: Why dependent role runs twice when passing the parameter?</p>