Closed nembery closed 4 years ago
Example: snippets:
Example of when to fail with fail_message: snippets:
This example will run get_system_info only if it hasn't been run before. We know that because sw_version is a variable that will be captured when it's run. If it is not defined, then run this again so we know all the device facts.
Next run 'get_policy_objects' if the model == vm-50. Once run, count the output to see if we have more than 3 policy objects already and if so, fail with the fail_message
finally, run some_other_skillet. Note that if we do not have a vm-50, then the second skillet will be skipped and we can go directly to the last step
Also, Ansible has a very nice concept where they only take the conditional from the yaml and automatically wrap it in the 'if' 'else', 'endif' stuff. Example here: https://github.com/ansible/ansible/blob/421d67f1ee6e03d9768c5ab966ed3ee8fa3e36df/lib/ansible/playbook/conditional.py#L192
We should look at this and see if we can just wrap the conditional, or if we should also do the additional checks as well for various safety reasons...
example in that case would just be something like: snippets:
Current implementation only allows a list of skillets to execute in order. This FR should at least do the following: