Using Host Variables in Task

For e.g, I have these hosts in my inventory:

Since you named the variable name, it is just

{{ name }}