title: How to pass a list as extra variable in Ansible CLI?
body: <p>Is there a way to override an Ansible variable by passing it as an <code>--extra-var</code>/<code>-e</code> from the CLI.  The catch is that the variable I want to override is a list and I can't figure out the correct syntax.</p>
  
  <p>Here's what the variable looks like in my <code>group_vars</code> file:</p>
  
  <pre><code>my_variable:
      - { var1: "value1", var2: "value2" }
      ...
  </code></pre>
  
  <p>Here's what my command looks like:</p>
  
  <pre><code>ansible-playbook -i inventory playbook.yml -e 'my_variable={ var1: value1, var2: value2 }' --limit 1.2.3.4 --diff --check
  </code></pre>
  
  <p>I get the following error:</p>
  
  <blockquote>
    <p>fatal: [1.2.3.4] => with_items expects a list or a set</p>
  </blockquote>
  
  <p>Is this possible?  What am I doing wrong?</p>