title: Ansible - check variable type
body: <p>Apparently, according to several hours of searching nobody has encountered this use-case:</p>
  
  <p>Its simple - I would like to execute some ansible logic depending on variable type. Basically equivalent of e.g. <code>instanceof(dict, var_name)</code> but in Ansible:</p>
  
  <pre><code>- name: test
    debug:
      msg: "{{ instanceof(var_name, dict) | ternary('is a dictionary', 'is something else') }}"
  </code></pre>
  
  <p>Is there any way this can be done?</p>