I did some searching in the forums, and there seems to be a few posts regarding tags and includes, but none of them seem to explicitly answer what I’m envisioning in my head.
As mentioned previously, in my efforts to simplify the setup, I would like to have one cron.yaml file, which has all crons possible, with tags. So, conceptually you have:
cron.yaml → … tasks:
- cron: blah blah tags: - boxtype1
- cron blah blah2 tags: - boxtype 2
- cron blah blah3 tags: - all
With that being said, I’d like to have a “boxtype1.yaml” file that has something like:
- include: cron.yaml – tags=all,boxtype1 or - include cron.yaml tags=all,boxtype1
I’m well aware about passing variables via this method, as discussed in one of my previous posts, but either way, it seems to run all entries in cron.yaml and not the sepcific one (it should be noted, running from the command line with --tags= works, so i know the cron.yaml syntax is “correct”
Yes, that much I knew / figured after reading and experimenting.
So other that using that as a variable to call in the cron.yaml file (which I think you referred to as a messy hack), is there anyway to achieve the desired results?
The goal is to include a yaml but filter which jobs to run on that include.
Excerpts from BrianAI's message of 2013-12-03 06:08:08 -0500:
Yes, that much I knew / figured after reading and experimenting.
So other that using that as a variable to call in the cron.yaml file
(which I think you referred to as a messy hack), is there anyway to
achieve the desired results?
The goal is to include a yaml but filter which jobs to run on that include.
You'll have to "fake it" by picking a variable name and testing on it
for each task.
- debug: msg="this is probably a task"
when: "'jam_master_jay' in cron_tags"
Seems like the cleaner way to do this is probably to just spend the time to rewrite stuff to roles. I spoke with someone locally about this, and they showed me the way they were doing it with roles. it seems like what I’m doing is very similar conceptually, but different in execution. I was looking to have central configs tagged with keywords that can then be included and only execute stuff with a certain tag.
Roles seems to accomplish this, but I can’t store all the configs in one location I have to create a hierarchy of folders / etc. And that’s not the worst solution in the world, just different. thanks for everyones help!!
(I still think being able to include and execute only certain tags from that include )