In Ansible, if you run a task that has some module’s parameter with a variable that is not set you will get “The task includes an option with an undefined variable” error.
If for some reason you can’t or don’t want to define this variable, you can make it optional.
In this case Ansible will ignore the parameter with the optional variable if it is not defined.
This note shows how to skip a module’s parameter in Ansible if a variable is not defined. (more…)