<p>I am trying to pass the debug message to conditional on Kubernetes object but it looks like it doesn't recognise it properly:</p>
<pre><code>- name: get some service status log
  kubernetes.core.k8s_log:
    namespace: &quot;{{ product.namespace }}&quot;
    label_selectors:
    - app.kubernetes.io/name=check-service-existence
  register: service_existence

- name: some service existence check log
  debug:
    msg: &quot;{{ service_existence.log_lines | first }}&quot;

- name: create service for &quot;{{ product.namespace }}&quot;
  kubernetes.core.k8s:
    state: present
    template: create-service.j2
    wait: yes
    wait_timeout: 300
    wait_condition:
      type: &quot;Complete&quot;
      status: &quot;True&quot;
  when: service_existence  == &quot;service_does_not_exist&quot;
</code></pre>
<p>what I am getting when I am running it is:</p>
<pre><code>TASK [playbook : some service existence check log] ***
ok: [127.0.0.1] =&gt; 
  msg: service_does_not_exist

TASK [playbook : create service for &quot;namespace&quot;] ***
skipping: [127.0.0.1]
</code></pre>
<p>I suspect that it treats <code>msg:</code> as a part of string. How can I deal with this properly?</p>

DisplayName
<p>Since your debug message is about the value of <code> service_existence.log_lines | first</code> your conditional should also be.</p>
<pre class="lang-yaml prettyprint-override"><code>when: service_existence.log_lines | first  == &quot;service_does_not_exist&quot;
</code></pre>
