Gather_Fact Issue while Configure New VM

Hi Team,

I want to configure new VM and ssh login setup 1st time through Ansible Playbook below is code.

Any Help on This issue ?

Set the ssh key, disconnect and then reconnect using it. Conversely you can put the service account and key in the template your using and avoid setting it on first boot.

Can you please Show me one Example ?

Thank you