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/d2a49762-586e-4bbb-9d5f-e9749466fb18%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.