Debian Codegraph @

src/ansiblelint/schemas/rulebook.json

raw
1 {
2 "$schema": "http://json-schema.org/draft-07/schema#",
3 "$id": "https://raw.githubusercontent.com/ansible/ansible-rulebook/main/ansible_rulebook/schema/ruleset_schema.json",
4 "title": "Ansible Rulebook",
5 "description": "See https://docs.ansible.com/projects/rulebook/en/latest/rulebooks.html",
6 "type": "array",
7 "items": {
8 "$ref": "#/$defs/ruleset"
9 },
10 "minItems": 1,
11 "examples": [
12 "rulebooks/*.yml",
13 "rulebooks/*.yaml"
14 ],
15 "$defs": {
16 "ruleset": {
17 "type": "object",
18 "properties": {
19 "default_events_ttl": {
20 "type": "string",
21 "pattern": "^\\d+\\s(seconds?|minutes?|hours?|days?)$"
22 },
23 "hosts": {
24 "type": "string"
25 },
26 "gather_facts": {
27 "type": "boolean",
28 "default": false
29 },
30 "match_multiple_rules": {
31 "type": "boolean",
32 "default": false
33 },
34 "name": {
35 "type": "string"
36 },
37 "execution_strategy": {
38 "type": "string",
39 "enum": [
40 "parallel",
41 "sequential"
42 ],
43 "default": "sequential"
44 },
45 "sources": {
46 "type": "array",
47 "items": {
48 "$ref": "#/$defs/source"
49 }
50 },
51 "rules": {
52 "type": "array",
53 "items": {
54 "$ref": "#/$defs/rule"
55 }
56 }
57 },
58 "required": [
59 "name",
60 "hosts",
61 "sources",
62 "rules"
63 ],
64 "additionalProperties": false
65 },
66 "source": {
67 "type": "object",
68 "properties": {
69 "name": {
70 "type": "string"
71 },
72 "filters": {
73 "type": "array",
74 "items": {
75 "type": "object"
76 }
77 }
78 },
79 "additionalProperties": {
80 "oneOf": [
81 {
82 "type": "object"
83 },
84 {
85 "type": "null"
86 }
87 ]
88 }
89 },
90 "throttle": {
91 "type": "object",
92 "oneOf": [
93 {
94 "required": [
95 "once_within",
96 "group_by_attributes"
97 ]
98 },
99 {
100 "required": [
101 "once_after",
102 "group_by_attributes"
103 ]
104 },
105 {
106 "required": [
107 "accumulate_within",
108 "threshold",
109 "group_by_attributes"
110 ]
111 }
112 ],
113 "properties": {
114 "once_within": {
115 "type": "string",
116 "pattern": "^\\d+\\s(milliseconds?|seconds?|minutes?|hours?|days?)$"
117 },
118 "once_after": {
119 "type": "string",
120 "pattern": "^\\d+\\s(milliseconds?|seconds?|minutes?|hours?|days?)$"
121 },
122 "accumulate_within": {
123 "type": "string",
124 "pattern": "^\\d+\\s(milliseconds?|seconds?|minutes?|hours?|days?)$"
125 },
126 "threshold": {
127 "type": "integer",
128 "minimum": 1
129 },
130 "group_by_attributes": {
131 "type": "array",
132 "items": {
133 "type": "string"
134 }
135 }
136 },
137 "additionalProperties": false
138 },
139 "rule": {
140 "type": "object",
141 "oneOf": [
142 {
143 "required": [
144 "name",
145 "condition",
146 "actions"
147 ]
148 },
149 {
150 "required": [
151 "name",
152 "condition",
153 "action"
154 ]
155 }
156 ],
157 "properties": {
158 "name": {
159 "type": "string",
160 "minLength": 1,
161 "pattern": "\\S"
162 },
163 "enabled": {
164 "type": "boolean"
165 },
166 "throttle": {
167 "$ref": "#/$defs/throttle"
168 },
169 "condition": {
170 "anyOf": [
171 {
172 "type": "string"
173 },
174 {
175 "type": "boolean"
176 },
177 {
178 "$ref": "#/$defs/all-condition"
179 },
180 {
181 "$ref": "#/$defs/any-condition"
182 },
183 {
184 "$ref": "#/$defs/not-all-condition"
185 }
186 ]
187 },
188 "actions": {
189 "type": "array",
190 "items": {
191 "oneOf": [
192 {
193 "$ref": "#/$defs/run-playbook-action"
194 },
195 {
196 "$ref": "#/$defs/run-module-action"
197 },
198 {
199 "$ref": "#/$defs/run-job-template-action"
200 },
201 {
202 "$ref": "#/$defs/run-workflow-template-action"
203 },
204 {
205 "$ref": "#/$defs/post-event-action"
206 },
207 {
208 "$ref": "#/$defs/set-fact-action"
209 },
210 {
211 "$ref": "#/$defs/retract-fact-action"
212 },
213 {
214 "$ref": "#/$defs/print-event-action"
215 },
216 {
217 "$ref": "#/$defs/debug-action"
218 },
219 {
220 "$ref": "#/$defs/none-action"
221 },
222 {
223 "$ref": "#/$defs/shutdown-action"
224 },
225 {
226 "$ref": "#/$defs/pg-notify-action"
227 }
228 ]
229 }
230 },
231 "action": {
232 "oneOf": [
233 {
234 "$ref": "#/$defs/run-playbook-action"
235 },
236 {
237 "$ref": "#/$defs/run-module-action"
238 },
239 {
240 "$ref": "#/$defs/run-job-template-action"
241 },
242 {
243 "$ref": "#/$defs/run-workflow-template-action"
244 },
245 {
246 "$ref": "#/$defs/post-event-action"
247 },
248 {
249 "$ref": "#/$defs/set-fact-action"
250 },
251 {
252 "$ref": "#/$defs/retract-fact-action"
253 },
254 {
255 "$ref": "#/$defs/print-event-action"
256 },
257 {
258 "$ref": "#/$defs/debug-action"
259 },
260 {
261 "$ref": "#/$defs/none-action"
262 },
263 {
264 "$ref": "#/$defs/shutdown-action"
265 },
266 {
267 "$ref": "#/$defs/pg-notify-action"
268 }
269 ]
270 }
271 },
272 "additionalProperties": false
273 },
274 "all-condition": {
275 "type": "object",
276 "properties": {
277 "all": {
278 "type": "array",
279 "items": {
280 "type": "string"
281 }
282 },
283 "timeout": {
284 "type": "string",
285 "pattern": "^\\d+\\s(milliseconds?|seconds?|minutes?|hours?|days?)$"
286 }
287 },
288 "additionalProperties": false
289 },
290 "not-all-condition": {
291 "type": "object",
292 "properties": {
293 "not_all": {
294 "type": "array",
295 "items": {
296 "type": "string"
297 }
298 },
299 "timeout": {
300 "type": "string",
301 "pattern": "^\\d+\\s(milliseconds?|seconds?|minutes?|hours?|days?)$"
302 }
303 },
304 "required": [
305 "timeout",
306 "not_all"
307 ],
308 "additionalProperties": false
309 },
310 "any-condition": {
311 "type": "object",
312 "properties": {
313 "any": {
314 "type": "array",
315 "items": {
316 "type": "string"
317 }
318 }
319 },
320 "additionalProperties": false
321 },
322 "run-playbook-action": {
323 "type": "object",
324 "properties": {
325 "run_playbook": {
326 "type": "object",
327 "properties": {
328 "copy_files": {
329 "type": "boolean"
330 },
331 "name": {
332 "type": "string"
333 },
334 "post_events": {
335 "type": "boolean"
336 },
337 "set_facts": {
338 "type": "boolean"
339 },
340 "ruleset": {
341 "type": "string"
342 },
343 "verbosity": {
344 "type": "integer"
345 },
346 "var_root": {
347 "type": [
348 "string",
349 "object"
350 ]
351 },
352 "json_mode": {
353 "type": "boolean"
354 },
355 "retry": {
356 "type": "boolean"
357 },
358 "retries": {
359 "type": "integer"
360 },
361 "delay": {
362 "type": "number"
363 },
364 "extra_vars": {
365 "type": "object"
366 },
367 "lock": {
368 "type": "string"
369 }
370 },
371 "required": [
372 "name"
373 ],
374 "additionalProperties": false
375 }
376 },
377 "required": [
378 "run_playbook"
379 ],
380 "additionalProperties": false
381 },
382 "run-module-action": {
383 "type": "object",
384 "properties": {
385 "run_module": {
386 "type": "object",
387 "properties": {
388 "name": {
389 "type": "string"
390 },
391 "post_events": {
392 "type": "boolean"
393 },
394 "set_facts": {
395 "type": "boolean"
396 },
397 "verbosity": {
398 "type": "integer"
399 },
400 "var_root": {
401 "type": [
402 "string",
403 "object"
404 ]
405 },
406 "json_mode": {
407 "type": "boolean"
408 },
409 "retry": {
410 "type": "boolean"
411 },
412 "retries": {
413 "type": "integer"
414 },
415 "delay": {
416 "type": "number"
417 },
418 "module_args": {
419 "type": [
420 "object",
421 "string"
422 ]
423 },
424 "extra_vars": {
425 "type": "object"
426 },
427 "lock": {
428 "type": "string"
429 }
430 },
431 "required": [
432 "name"
433 ],
434 "additionalProperties": false
435 }
436 },
437 "required": [
438 "run_module"
439 ],
440 "additionalProperties": false
441 },
442 "run-job-template-action": {
443 "type": "object",
444 "properties": {
445 "run_job_template": {
446 "type": "object",
447 "properties": {
448 "name": {
449 "type": "string"
450 },
451 "organization": {
452 "type": "string"
453 },
454 "job_args": {
455 "type": "object"
456 },
457 "post_events": {
458 "type": "boolean"
459 },
460 "set_facts": {
461 "type": "boolean"
462 },
463 "ruleset": {
464 "type": "string"
465 },
466 "var_root": {
467 "type": "string"
468 },
469 "retry": {
470 "type": "boolean"
471 },
472 "retries": {
473 "type": "integer"
474 },
475 "delay": {
476 "type": "integer"
477 },
478 "include_events": {
479 "type": "boolean",
480 "default": true
481 },
482 "lock": {
483 "type": "string"
484 },
485 "labels": {
486 "type": "array",
487 "items": {
488 "type": "string"
489 }
490 },
491 "add_event_uuid_label": {
492 "type": "boolean",
493 "default": false
494 }
495 },
496 "required": [
497 "name",
498 "organization"
499 ],
500 "additionalProperties": false
501 }
502 },
503 "required": [
504 "run_job_template"
505 ],
506 "additionalProperties": false
507 },
508 "run-workflow-template-action": {
509 "type": "object",
510 "properties": {
511 "run_workflow_template": {
512 "type": "object",
513 "properties": {
514 "name": {
515 "type": "string"
516 },
517 "organization": {
518 "type": "string"
519 },
520 "job_args": {
521 "type": "object"
522 },
523 "post_events": {
524 "type": "boolean"
525 },
526 "set_facts": {
527 "type": "boolean"
528 },
529 "ruleset": {
530 "type": "string"
531 },
532 "var_root": {
533 "type": "string"
534 },
535 "retry": {
536 "type": "boolean"
537 },
538 "retries": {
539 "type": "integer"
540 },
541 "delay": {
542 "type": "integer"
543 },
544 "include_events": {
545 "type": "boolean",
546 "default": true
547 },
548 "lock": {
549 "type": "string"
550 },
551 "labels": {
552 "type": "array",
553 "items": {
554 "type": "string"
555 }
556 },
557 "add_event_uuid_label": {
558 "type": "boolean",
559 "default": false
560 }
561 },
562 "required": [
563 "name",
564 "organization"
565 ],
566 "additionalProperties": false
567 }
568 },
569 "required": [
570 "run_workflow_template"
571 ],
572 "additionalProperties": false
573 },
574 "pg-notify-action": {
575 "type": "object",
576 "properties": {
577 "pg_notify": {
578 "type": "object",
579 "properties": {
580 "dsn": {
581 "type": "string"
582 },
583 "channel": {
584 "type": "string"
585 },
586 "event": {
587 "type": [
588 "string",
589 "object"
590 ]
591 },
592 "remove_meta": {
593 "type": "boolean",
594 "default": false
595 }
596 },
597 "required": [
598 "dsn",
599 "channel",
600 "event"
601 ],
602 "additionalProperties": false
603 }
604 },
605 "required": [
606 "pg_notify"
607 ],
608 "additionalProperties": false
609 },
610 "post-event-action": {
611 "type": "object",
612 "properties": {
613 "post_event": {
614 "type": "object",
615 "properties": {
616 "ruleset": {
617 "type": "string"
618 },
619 "event": {
620 "type": "object"
621 }
622 },
623 "required": [
624 "event"
625 ],
626 "additionalProperties": false
627 }
628 },
629 "required": [
630 "post_event"
631 ],
632 "additionalProperties": false
633 },
634 "set-fact-action": {
635 "type": "object",
636 "properties": {
637 "set_fact": {
638 "type": "object",
639 "properties": {
640 "ruleset": {
641 "type": "string"
642 },
643 "fact": {
644 "type": "object"
645 }
646 },
647 "required": [
648 "fact"
649 ],
650 "additionalProperties": false
651 }
652 },
653 "required": [
654 "set_fact"
655 ],
656 "additionalProperties": false
657 },
658 "retract-fact-action": {
659 "type": "object",
660 "properties": {
661 "retract_fact": {
662 "type": "object",
663 "properties": {
664 "ruleset": {
665 "type": "string"
666 },
667 "fact": {
668 "type": "object"
669 },
670 "partial": {
671 "type": "boolean",
672 "default": true
673 }
674 },
675 "required": [
676 "fact"
677 ],
678 "additionalProperties": false
679 }
680 },
681 "required": [
682 "retract_fact"
683 ],
684 "additionalProperties": false
685 },
686 "print-event-action": {
687 "type": "object",
688 "properties": {
689 "print_event": {
690 "type": [
691 "object",
692 "null"
693 ],
694 "properties": {
695 "var_root": {
696 "type": [
697 "string",
698 "object"
699 ]
700 },
701 "pretty": {
702 "type": "boolean"
703 }
704 },
705 "additionalProperties": false
706 }
707 },
708 "required": [
709 "print_event"
710 ],
711 "additionalProperties": false
712 },
713 "debug-msg": {
714 "type": "object",
715 "properties": {
716 "msg": {
717 "anyOf": [
718 {
719 "type": "string"
720 },
721 {
722 "type": "array",
723 "items": {
724 "type": "string"
725 }
726 }
727 ]
728 }
729 },
730 "additionalProperties": false
731 },
732 "debug-var": {
733 "type": "object",
734 "properties": {
735 "var": {
736 "type": "string"
737 }
738 },
739 "additionalProperties": false
740 },
741 "debug-action": {
742 "type": "object",
743 "properties": {
744 "debug": {
745 "anyOf": [
746 {
747 "$ref": "#/$defs/debug-msg"
748 },
749 {
750 "$ref": "#/$defs/debug-var"
751 },
752 {
753 "type": "null"
754 }
755 ]
756 }
757 },
758 "additionalProperties": false,
759 "required": [
760 "debug"
761 ]
762 },
763 "none-action": {
764 "type": "object",
765 "properties": {
766 "none": {
767 "type": [
768 "object",
769 "null"
770 ]
771 }
772 },
773 "required": [
774 "none"
775 ],
776 "additionalProperties": false
777 },
778 "shutdown-action": {
779 "type": "object",
780 "properties": {
781 "shutdown": {
782 "type": [
783 "object",
784 "null"
785 ],
786 "properties": {
787 "delay": {
788 "type": "number"
789 },
790 "message": {
791 "type": "string"
792 },
793 "kind": {
794 "type": "string",
795 "enum": [
796 "graceful",
797 "now"
798 ]
799 }
800 },
801 "additionalProperties": false
802 }
803 },
804 "required": [
805 "shutdown"
806 ],
807 "additionalProperties": false
808 }
809 }
810 }