summaryrefslogtreecommitdiffstats
path: root/lib/ansible/plugins/filter/mandatory.yml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ansible/plugins/filter/mandatory.yml')
-rw-r--r--lib/ansible/plugins/filter/mandatory.yml21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/ansible/plugins/filter/mandatory.yml b/lib/ansible/plugins/filter/mandatory.yml
new file mode 100644
index 0000000..5addf15
--- /dev/null
+++ b/lib/ansible/plugins/filter/mandatory.yml
@@ -0,0 +1,21 @@
+DOCUMENTATION:
+ name: mandatory
+ version_added: "historical"
+ short_description: make a variable's existance mandatory
+ description:
+ - Depending on context undefined variables can be ignored or skipped, this ensures they force an error.
+ positional: _input
+ options:
+ _input:
+ description: Mandatory expression.
+ type: raw
+ required: true
+EXAMPLES: |
+
+ # results in a Filter Error
+ {{ notdefined | mandatory }}
+
+RETURN:
+ _value:
+ description: The input if defined, otherwise an error.
+ type: raw