<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
<li>Feature Idea</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>

<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[root@k8s-09 deploy-on-k8s]# ansible --version
ansible 2.3.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
[root@k8s-09 deploy-on-k8s]#"><pre class="notranslate"><code class="notranslate">[root@k8s-09 deploy-on-k8s]# ansible --version
ansible 2.3.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
[root@k8s-09 deploy-on-k8s]#
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">CentOS 7</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">I am not sure the root reason.<br>
"namespace" and "gitlab_deploy_suffix_name" are vars and work well at other places.<br>
I assume 'register' and 'when' support vars too.<br>
I do not know what is the meaning in the error message:</p>
<h1 dir="auto">The error was: |failed expects a dictionary</h1>
<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="
 32 # Service
 33 - name: check &quot;{{ gitlab_deploy_suffix_name }}&quot; svc exist or not
 34   command: &quot;kubctl get svc {{ [namespace, gitlab_deploy_suffix_name]|join('-') }} --namespace={{ namespace }}&quot;
 35   register: &quot;{{ [namespace, gitlab_deploy_suffix_name]|join('-') }}_exists&quot;
 36   ignore_errors: True
 37
 38 - name: &quot;create gitlab svc if it does not exist and its deployment exists or just created succeefully&quot;
 39   shell: &quot;notify to create {{ gitlab_deploy_suffix_name }} service&quot;
 40   when:  &quot;{{ [namespace, gitlab_deploy_suffix_name]|join('-') }}_exists|failed&quot;
 41   ignore_errors: True
 42   notify: &quot;create {{ gitlab_deploy_suffix_name }} service&quot;"><pre class="notranslate"> <span class="pl-s">32 </span><span class="pl-c"><span class="pl-c">#</span> Service</span>
 <span class="pl-ent">33 - name</span>: <span class="pl-s">check "{{ gitlab_deploy_suffix_name }}" svc exist or not</span>
 <span class="pl-ent">34   command</span>: <span class="pl-s"><span class="pl-pds">"</span>kubctl get svc {{ [namespace, gitlab_deploy_suffix_name]|join('-') }} --namespace={{ namespace }}<span class="pl-pds">"</span></span>
 <span class="pl-ent">35   register</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ [namespace, gitlab_deploy_suffix_name]|join('-') }}_exists<span class="pl-pds">"</span></span>
 <span class="pl-ent">36   ignore_errors</span>: <span class="pl-c1">True</span>
 <span class="pl-s">37</span>
 <span class="pl-ent">38 - name</span>: <span class="pl-s"><span class="pl-pds">"</span>create gitlab svc if it does not exist and its deployment exists or just created succeefully<span class="pl-pds">"</span></span>
 <span class="pl-ent">39   shell</span>: <span class="pl-s"><span class="pl-pds">"</span>notify to create {{ gitlab_deploy_suffix_name }} service<span class="pl-pds">"</span></span>
 <span class="pl-ent">40   when</span>:  <span class="pl-s"><span class="pl-pds">"</span>{{ [namespace, gitlab_deploy_suffix_name]|join('-') }}_exists|failed<span class="pl-pds">"</span></span>
 <span class="pl-ent">41   ignore_errors</span>: <span class="pl-c1">True</span>
 <span class="pl-ent">42   notify</span>: <span class="pl-s"><span class="pl-pds">"</span>create {{ gitlab_deploy_suffix_name }} service<span class="pl-pds">"</span></span></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="fatal: [k8s-09]: FAILED! =&gt; {&quot;failed&quot;: true, &quot;msg&quot;: &quot;The conditional check '{{ [namespace, gitlab_deploy_suffix_name]|join('-') }}_exists|failed' failed. The error was: |failed expects a dictionary\n\nThe error appears to have been in '/root/temp-bruce/deploy-on-k8s/roles/k8s/tasks/main.yml': line 38, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: \&quot;create gitlab svc if it does not exist and its deployment exists or just created succeefully\&quot;\n  ^ here\n&quot;}"><pre class="notranslate"><code class="notranslate">fatal: [k8s-09]: FAILED! =&gt; {"failed": true, "msg": "The conditional check '{{ [namespace, gitlab_deploy_suffix_name]|join('-') }}_exists|failed' failed. The error was: |failed expects a dictionary\n\nThe error appears to have been in '/root/temp-bruce/deploy-on-k8s/roles/k8s/tasks/main.yml': line 38, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: \"create gitlab svc if it does not exist and its deployment exists or just created succeefully\"\n  ^ here\n"}
</code></pre></div>
<p dir="auto">Hi,</p>
<p dir="auto">I encountered a problem with conditional role dependencies. The case is as follows:</p>
<p dir="auto">Role a depends on role b when var want_b is true.<br>
Role b depends on role c when var want_c is true.</p>
<p dir="auto">When want_b is false and want_c is true I expect both roles b and c to be skipped, because role b is skipped and role c is a dependency of role b. What happens is that role c is run anyway.</p>
<p dir="auto">Very simple playbook illustrating this problem:<br>
<a href="https://github.com/tronner/ansible-bug-roledep-conditions">https://github.com/tronner/ansible-bug-roledep-conditions</a></p>