Looks like you are attempting to include a playbook.

You probably want to use pre_tasks instead of tasks for the first part to 
ensure things run in the order you want too.  This would like something 
like the following:

---
- hosts: localhost
  vars_files:
      - /etc/ansible/parent/parent.yml
  pre_tasks:
    - name: Template the component properties files
      template:
        src=/etc/ansible/templates/{{item}}.j2
        dest=/etc/ansible/templates/{{item}}/service-container.properties
      with_items:
        - [ 'router',  'report-scheduler', 'WH-Payload-Processor']

 - include: /etc/ansible/playbooks/wrapper.yml 


On Wednesday, September 30, 2015 at 3:21:54 PM UTC+1, Jugal Porwal wrote:
>
> Hi,
>
> I'm trying to include a play from different play book. The structure is as 
> follows:
>
> ---
> - hosts: localhost
>   vars_files:
>       - /etc/ansible/parent/parent.yml
>   tasks:
>     - name: Template the component properties files
>       template:
>         src=/etc/ansible/templates/{{item}}.j2
>         dest=/etc/ansible/templates/{{item}}/service-container.properties
>       with_items:
>         - [ 'router',  'report-scheduler', 'WH-Payload-Processor']
>
>   tasks:
>     - include: /etc/ansible/playbooks/wrapper.yml 
>
> ---
> - hosts: localhost
>   tasks:
>     - name: Template the wrapper.conf file
>       template:
>         src=/etc/ansible/templates/wrapper.j2
>         dest=/etc/ansible/templates/router/wrapper.conf
>       vars:
>         - serviceName: router
>
> However i get the error "no task detected". what is the issue here?
>
> =>Also is this feasible:
>
> ---
> - hosts: localhost
>   vars_files:
>       - /etc/ansible/parent/parent.yml
>   tasks:
>     - name: Template the component properties files
>       template:
>         src=/etc/ansible/templates/{{item}}.j2
>         dest=/etc/ansible/templates/{{item}}/service-container.properties
>       with_items:
>         - [ 'router',  'report-scheduler', 'WH-Payload-Processor']
>
>   tasks:
>     - include: /etc/ansible/playbooks/wrapper.yml  some_var={{item}}
>       with_items
>            - router
>            - gateway
>            - resource
>
> ---
> - hosts: localhost
>   tasks:
>     - name: Template the wrapper.conf file
>       template:
>         src=/etc/ansible/templates/wrapper.j2
>         dest=/etc/ansible/templates/{{item}}/wrapper.conf
>       vars:
>         - serviceName: {{item}}
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/4c442225-3927-4551-b39a-94b641f604b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to