Hi Brain,

thanks for the explanation. Here is similar problem we have:
We have a download role which should download something from given 
location(web, maven, local).
So when location is maven, I dont want to execute http steps.
But when "when" statement is after include this means that all tasks in 
included yml will be executed with it.
But i would like to skip complete yml.
---
- debug: msg="Debug location: {{ location }}"

- include: maven.yml
  when: location == "maven"

- include: http.yml
  when: location == "http"

- include: local.yml
  when: location == "local"

when location is maven i want to completly skip http and local.
I found discussion about this:
https://github.com/ansible/ansible/issues/3324

What would may be help here, would be something like goto statement:
goto: end of the playbook
goto: task="task-name"
goto: exit ansible

With this would be possible to simulate if-else in playbooks.
What do you think about this?

Vlado



On Thursday, July 16, 2015 at 9:07:17 PM UTC+2, Brian Coca wrote:
>
> Hi Vlado, 
>
> I think you are misunderstanding the feature. There is no sub 
> -election with tags on role definition, when you: 
>  - {role: testrole, tags: ['aaaa']} 
>
> What you are doing is tagging all tasks in testrole with 'aaaa' on top 
> of existing tags. So it would look like this once imported: 
>
> - name: aaaa tag 
>   local_action: command echo 
>   tags: 
>     - aaaa 
>
> - name: bbbb tag 
>   local_action: command echo 
>   tags: 
>     - bbbb 
>     - aaaa 
>
> You are not saying 'run only those tagged with 'aaaa', that is not 
> possible when specifying a role to import. 
> I suggest making 2 roles and only importing the one with the tasks you 
> want to execute. 
>
>
> -- 
> 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/ccb5d0dc-7164-461d-923d-f5b07e19dc8b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to