A pound '#' sign in password

We want to use ansible to connect to a managed device. We have created a host_var file with the username and the password. Here is the host_var/mydevice file:

Hi,

have you tried adding quotes?

username: myuser
password: 'secret#secret'

Otherwise YAML might interpret everything after # as a comment.

Cheers,
Felix