docker installation problems

I am using ansible to install a docker but I get this error. How can i solve this please?
Please help me, this installation has taken me a whole week

Control node is ubuntu server 20.04
Target node is ubuntu desktop 18.04 on vmware esxi

this is my playbook:

Look like you need to add become_user option there

I just added become_user: root but the same problem

Sorry, it should be become: true
By default it will elevate the account to root. You may need to pass become_user_pass as well.

You're using localhost as the target, which is OK for the vmware
module (as that is an API based one), but then you also target
localhost for the docker stuff.
Split your deployment into separate playbook and make sure you're
targeting the correct host.
This may involve add_host etc.

I added become_user: true
become_user_pass: true
I got the same error without the pass, but when i add the pass, i get this:

ERROR! ‘become_user_pass’ is not a valid attribute for a Play

I wish i could separate them as you have told me but i am very new to ansible and I am using it for my final project. I dont know how to do that. I changed the host to the target node’s name. I think you are right because the localhost does the installation of the docker on the control node. But I do not know what to do.

I wish i could separate them as you have told me but i am very new to ansible and I am using it for my final project. I dont know how to do that. I changed the host to the target node's name. I think you are right because the localhost does the installation of the docker on the control node. But I do not know what to do.

Here is a sample ansible playbook; don't know who wrote it. Take a
look at it. Ask questions. Once you understand it, what you are trying
to do should make sense.

https://www.ansible.com/blog/getting-started-writing-your-first-playbook

A playbook is a list of plays. Example:

Thank you so much. I am looking at it

Thank you very much…taking a look at it