title: Passing elements of multi-dimensional array in Ansible using Extra-vars
body: <p>I have a harness to build VMs using Packer that in turn calls Ansible (in local mode) to do the heavy lifting.<br>
  I'd like to be able to parameters to Packer (got that), which is passes to Ansible as extra vars.<br></p>
  
  <p>I can pass an external variables files and also a simple variable such as the example below. <br></p>
  
  <pre><code>ansible-playbook -v -c local something.yml --extra-vars "deploy_loc=custom"
  </code></pre>
  
  <p>Thats okay, but I really need to pass  more complex array of variables, such as the examples below.<br>
  I've tried a number of formatting such as the one below and usually get some kind of delimiter error.</p>
  
  <pre><code>ansible-playbook -v -c local something.yml --extra-vars 'deploy_loc=custom deploy_scen: [custom][ip=1.2.34]}'
  </code></pre>
  
  <p>Role variable file</p>
  
  <pre><code># Which location
  deploy_loc: 'external-dhcp'
  
  # location defaults
  deploy_scen:
    custom:
       ipv4: yes
       net_type: dhcp
       ip: '1.1.1.1'
       prefix: '24'
       gw: '1.1.1.1.254'
       host: 'custom'
       domain: 'domain.com'
       dns1: '1.1.1.2'
    standard-eng:
       ipv4: yes
       net_type: none
       ip: '12.12.12.5'
       prefix: '24'
    external-dhcp:
       ipv4: yes
       net_type: dhcp
  </code></pre>