title: Sort nested ansible dictionary by key
body: <p>We have an ansible task like this </p>
  
  <pre><code>- name: Migrate Zookeeper settings
    zoo_import:
      version: "{{ item[0] }}"
      content: "{{ item[1] }}"
    with_items: "{{ zk_import | dictsort }}"
  </code></pre>
  
  <p>The <em>zoo_import</em> module expects sting <em>version</em> and dict <em>content</em> and I guess <em>dictsort</em> produces list of tuples. </p>
  
  <p>So how do I pass a list item to the module? The most obvious variant content: {{ dict(item[1]) }} ends with "dictionary update sequence element #0 has length 1; 2 is required"</p>
  
  <p>Thanks.</p>
  
  <p>PS If it is important, the zk_import dictionary before sorting is like </p>
  
  <pre><code>zk_import:
    v20200420:
      to_update:
        '/path1/key1/': 'value2'
        '/path2/key1/': 'other value'
      to_delete:
        '/path/key/': 'value2'
        '/path/key1/subkey': 'other value'
    v20200425:
        etc...
  </code></pre>