Create VM on VMWare and register on RHN

Hi,

I’m a beginner on awx and ansible.

I have a template with RHEL7 on vmware and I trying to clone a vm and register on rhn.

My playbook create vm without issue and take all parameters from survey on awx, but I have a doubt how to register on RHN?
In my template there is already linux user ansible with ssh rsa public key in authorized_hosts, so my ansible can access without problems.

How to execute the task on new created host and not localhost?

you need to put add_host to it adds the vm created to the current inventory then do the RHN part. This blog has a good explanation
https://www.redhat.com/en/blog/creating-load-balanced-web-service-cloud-ansible

Thank you Jonathan for your suggestion.

Now I have this playbook:

try https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#turning-off-facts

I solved so: