pass variables to main.yml of a role

I have a couple of standalone playbooks which I am trying to transform to role-based execition.

At the start I get the hostname in a user dialog, then go in with the first play when ther is no ssh available on target yet to set up authorized_keys file, so I go in for the first play with user/pw combination which I want to pass as variables.

  • hosts: target_host_group
    vars_files: defaults.yml
    vars:
    ansible_ssh_pass: superawesomepwd
    ansible_user: user

I am aware that I need to make sure this is safe (probably using vault) yet, but that is not the point of my question here.

What I need to figure out is how to pass the paragraph above in the main.yaml of my initial role (and only that role, not the other ones).

using the syntax above or just

I found a solution here: https://www.dasblinkenlichten.com/ansible-roles-and-variables/

"In the role definition Variables can also be defined as part of a role.
There are two places this can be done with variables defined in either the ‘vars’ or the ‘default’ directory of the role. Much in the same way we defined other role functions, we can also define a ‘main.yml’ file in both of these directories that define variable to use as part of the role. For instance let’s assume that we have the following defined as ‘/etc/ansible/roles/webserver/defaults/main.yml’ "

/project