Dear Ansible enthousiasts,
When I write a role, I'd like to tell what are the variables that tasks and
templates will use. To prevent the interruption of the playbook in the
middle of the execution of a role because a variable is not set, I also
want to ensure that the playbook defines all mandatory variables.
My current approach is to provide a file `tasks/init.yml` in the role with
an assert command such as:
```yaml
- assert:
that:
- var != ''
tags: ["check"]
```
Then I include the file in `tasks/main.yml`:
```yaml
- include: init.yml
- ...
```
I can check the role with `ansible-playbook -i inventory playbook.yml -t
check`.
What do you think about that? Do you have best practices to solve the same
problems?
Your feedback is welcome :).
Cheers,
- Greg
--
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/b0d0e1b3-2337-44c3-9bf3-bdb1de5332c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.