1. Code two tasks. One with login_host param, one without. Use when to check if the login_host is defined or not defined. The idea is two execute one task bu t not the other depending on the variable in question.
2. Assign login_host a "good" default. In your case it would seem localhost is a good default.