exception=>"Java::JavaNet::URISyntaxException", :message=>"Illegal character in path at index 0: [\"esi1\",\"esi2\"]"

Yes, I understand what you are trying to do. The code that processes hosts expects to receive either a string containing a single host, or an array containing mulitple hosts. When you do that variable substitution it gets passed a string containing multiple hosts, and that does not work.

If it is always two hosts then you can use

hosts => [ "${HOST1}", "${HOST2}" ]