oh man - thank you :)

On Thursday, 28 April 2016 13:48:20 UTC+1, Brian Coca wrote:
>
> So you have 2 types of includes, plays or task lists, you are mixing play 
> level directives in an include inside a play, this is not permitted. 
>
> An include inside a play can ONLY have a list of tasks, you are putting 
> vars: and tasks: directives which implies play. In >=2.0 vars can now be 
> part of any task, so you can put it with the include itself.
>
>
> - name: Perform all prerequisite checks
>   hosts: localhost
>   tasks:
>     - include: prereqcheck_directories.yml
>       vars:
>         directories:
>          - directory: "/opt/test"
>          - directory: "/etc"
>          - directory: "/xyz"
>
> ​the included file:​
>
> ---
>     - name: Check directories exist
>       stat:
>         path: "{{ item.directory }}"
>       with_items: directories
>       register: directory_stat
>
>     - debug:
>         var: item.1.directory
>       with_indexed_items: directories
>       when: directory_stat.results[item.0].stat.exists
>
>
> ----------
> Brian Coca
>

-- 
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/05c1959c-ec90-4aec-a4b6-f370a594aa5f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to