title: How to combine json dictionary and lists in jinja template
body: <p>This is a follow-up to the excellent answer that I received in <a href="https://stackoverflow.com/questions/40915660/ansible-boto-aws-invalid-type-for-parameter-containerdefinitions0-memory" title="Ansible, Boto, AWS - Invalid type for parameter containerDefinitions[0].memory">Ansible, Boto, AWS - Invalid type for parameter containerDefinitions[0].memory</a>.</p>
  
  <p>I am not understanding how to combine the provided answer(s) properly.</p>
  
  <p>In my original ansible/roles/ecs_cluster_init/tasks/main.yaml file I have:</p>
  
  <pre><code>## ECS Task and Service Definitions
  - block:
      - name: Create ECS Service1 Task Definitions
        ecs_taskdefinition:
          region: "{{ region }}"
          containers:
            - name: "{{ item.name }}"
              cpu: 0
              essential: true
              image: "{{ item.image }}"
              memory: "{{ item.memory|int|abs }}"
              mountPoints: "{{ item.mounts }}"
              environment: "{{ item.env_vars }}"
              portMappings: "{{ item.portmap }}"
              entryPoint:
                - "java"
                - "-Xms{{ java_heap_size_initial }}"
                - "-Xmx{{ java_heap_size_max }}"
                - "-DlogDir=/host"
                - "-Dcom.sun.net.ssl.checkRevocation=false"
                - "-jar"
                - "/app.jar"
              logConfiguration:
                logDriver: "{{ ecs_task_log_configuration.logDriver }}"
                options:
                  max-size: "{{ ecs_task_log_configuration.options.max_size }}"
                  max-file: "{{ ecs_task_log_configuration.options.max_file }}"
          family: "{{ service_prefix }}-{{ item.name }}-{{ env_name }}"
          state: present
          increment_revision: true
          volumes: "{{ item.volumes }}"
        register: service1_task_definition
        with_items: "{{ ecs_task_definitions }}"
  </code></pre>
  
  <p>The initial answer that works for the services without an entryPoint was to do:</p>
  
  <pre><code>- name: Create ECS Service1 Task Definitions
    ecs_taskdefinition:
      region: "{{ region }}"
      containers: "{{'['+dict(name=item.name, cpu=0, image=item.image, memory=item.memory|int)|to_json+']'}}"
    with_items: "{{ ecs_task_definitions }}"
  </code></pre>
  
  <p>and the answer for how to handle the entryPoint key was:</p>
  
  <pre><code>entryPoint=('jav‌​a^-Xms'+java_heap_size_initial+'^-Xmx'+jav‌​a_heap_size_max+'^-D‌​logDir=/host^-Djava.‌​security.egd=file:/d‌​ev/./urandom^-D‌​com‌​.sun.net.ssl.chec‌​k‌​Revocation=false^-j‌‌​​ar^/app.jar').split‌​(‌​'^')
  </code></pre>
  
  <p>What I'm not getting is how to combine the two in my ansible/roles/ecs_cluster_init/tasks/main.yaml file. How do I get the entryPoint and subsequent logConfiguration lists into the container dictionary?</p>