Yeah, for sure there can be some workarounds but very tedious ones. Your
example can work but needs to be thought of at the very beginning of
organizing your repository and I can't see anyone that clever foreseeing
that far in the future about issue like this. Ones you have repository of
30 roles and more than hundred of playbooks retrofitting this into every
playbook for every task and who knows how many different variables (you
obviously need separate variable per tag type) is really impossible.
On Friday, December 18, 2015 at 6:37:18 AM UTC+11, Mike Biancaniello wrote:
>
> I agree that I'd like to be able to have roll contain a number of tasks
> and then have then selective run. A use-tags or play-tags option would be
> nice to use in that case. While you can certainly implement that with vars
> (see #2 below), it seems that a tags solution would be more elegant.
>
> There are also times when you want to insert debug tasks but don't want
> them to play by default and don't want to have to remember to always send
> --skip-tags='debug' every time you run a playbook.
>
> However, for now, I work around this in two ways:
>
> 1. I write a python script that calls the playbook and it sets the tags
> for me.
>
> e.g.
> ./run_playbook.py site.yml
>
> would essentially run:
>
> ansible-playbook -i hosts site.yml --skip-tags='debug'
>
> or something to that effect.
>
> 2. I require an extra-var to *not* skip.
>
> e.g.
> tasks:
> - name: Show vars
> debug: msg={{item.ansible_facts}}
> with_items: some_loaded_vars.results
> tags: debug
> when: debug|default(false)
>
>
> then:
>
> ansible-playbook site.yml -e '{"debug":true}'
>
> would execute that task.
>
--
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/194f03e2-26f9-4bf7-bcbe-f80731b4b63c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.