# Create VM on VMWare and register on RHN

**URL:** <https://forum.ansible.com/t/create-vm-on-vmware-and-register-on-rhn/28364>\
**Category:** Ansible Project\
**Tags:** vmware, awx\
**Created:** [August 19, 2018, 1:24pm UTC](https://forum.ansible.com/t/create-vm-on-vmware-and-register-on-rhn/28364 "2018-08-19T13:24:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![enzo.tano](https://avatars.discourse-cdn.com/v4/letter/e/6f9a4e/32.png) [@enzo.tano](https://forum.ansible.com/u/enzo.tano)\
**Post date:** [August 19, 2018, 1:24pm UTC](https://forum.ansible.com/t/create-vm-on-vmware-and-register-on-rhn/28364/1 "2018-08-19T13:24:16Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Jonathan\_Lozada\_De\_L](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@Jonathan\_Lozada\_De\_L](https://forum.ansible.com/u/Jonathan_Lozada_De_L)\
**Post date:** [August 19, 2018, 3:49pm UTC](https://forum.ansible.com/t/create-vm-on-vmware-and-register-on-rhn/28364/2 "2018-08-19T15:49:04Z")

</div>

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](https://www.redhat.com/en/blog/creating-load-balanced-web-service-cloud-ansible)

---

<div class="post-metadata">

**Author:** ![enzo.tano](https://avatars.discourse-cdn.com/v4/letter/e/6f9a4e/32.png) [@enzo.tano](https://forum.ansible.com/u/enzo.tano)\
**Post date:** [August 20, 2018, 12:38pm UTC](https://forum.ansible.com/t/create-vm-on-vmware-and-register-on-rhn/28364/3 "2018-08-20T12:38:09Z")

</div>

Thank you Jonathan for your suggestion.

Now I have this playbook:

---

<div class="post-metadata">

**Author:** ![Jonathan\_Lozada\_De\_L](https://avatars.discourse-cdn.com/v4/letter/j/eb8c5e/32.png) [@Jonathan\_Lozada\_De\_L](https://forum.ansible.com/u/Jonathan_Lozada_De_L)\
**Post date:** [August 20, 2018, 1:06pm UTC](https://forum.ansible.com/t/create-vm-on-vmware-and-register-on-rhn/28364/4 "2018-08-20T13:06:13Z")

</div>

try [https://docs.ansible.com/ansible/latest/user\_guide/playbooks\_variables.html#turning-off-facts](https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html#turning-off-facts)

---

<div class="post-metadata">

**Author:** ![enzo.tano](https://avatars.discourse-cdn.com/v4/letter/e/6f9a4e/32.png) [@enzo.tano](https://forum.ansible.com/u/enzo.tano)\
**Post date:** [August 20, 2018, 2:18pm UTC](https://forum.ansible.com/t/create-vm-on-vmware-and-register-on-rhn/28364/5 "2018-08-20T14:18:58Z")

</div>

I solved so:
