title: Syntax to pass dynamic variables to include_tasks along with with_item in Ansible playbook
body: <p>Executing parent.yml which in turn calls child.yml playbook for execution with dynamic variables.</p>
  
  <p>Variables from parent.yml aren`t interpolated inside child.yml playbook. Correct me if I am using correct syntax? </p>
  
  <p>Parent.yml</p>
  
  <pre><code>- name: Main playbook to call MySQL backup
    hosts: localhost
    gather_facts: no
  
    tasks:
    - include_task: child.yml
      vars:
        var1: "{{ item.name }}"
        var2: "{{ item.db_name }}"
      with_items:
         - { name: '10.10.10.01', db_name: 'prod1' }
         - { name: '10.10.10.02', db_name: 'prod2' }
  </code></pre>
  
  <p>child.yml (Takes mysqldump from managed DB)</p>
  
  <pre><code>- name: MySQL dump
    hosts: localhost
    #gather_facts: no
    #vars:
    #      v1: "{{ var1 }}"
    #      v2: "{{ var2 }}"
  
    tasks:
    - name: Executing the shell script
      shell: 'mysqldump -h "{{ var1 }}" -u"ansi" -p"*****" "{{ var2 }}"| gzip &gt; /tmp/mysql_dump/"{{ var2 }}"_`date +%Y%m%d-%H%M`.gz'
  </code></pre>
  
  <p>fatal: [127.0.0.1]: FAILED! => {"reason": "no action detected in task. This often indicates a misspelled module name, or incorrect module path.\n\nThe error appears to be in '/home/ansible/playbooks/DBpatch/Linux/child.yml': line 1, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: MySQL dump\n  ^ here\n"}</p>