SSH login into the server using different identities

Scenario:
I create a new virtual machine and have an ssh user name and password for this machine. Now I want to set up this vm. I have different tasks to run on this box with the first task being adding a user and setting up his identity on the newly created vm(ssh configuration for this user has already been done in the host box). Once done, I want my subsequent tasks to be run as this newly created user. I want this to be done in the same play. For example:

Play0 - Set up user foo in the box. This play does not have a user associated with it i.e I do not specify a user in the yml file for this play.
Play1 - Set up apache in this box. This play has a user associated with it i.e I specify the user to be foo for this play.

I include both the plays in a play book and run this play book with -u root and -k. Play0 succeeds but play1 does not even though ansible tries to login to the vm as user foo. I suspect this is happening because it tries to login as user foo with the password supplied but obviously foo uses key based auth for ssh login.

What is the recommended practise for this sort of scenario?