As you pointed out yourself, this seems to be a question related to the
usage of https://github.com/ansible-collections/vmware.vmware_rest, so that
would be the logical place to ask first, I would assume.
This list is more for general ansible questions rather than specific 3rd
party content.

On Thu, 20 Apr 2023 at 10:03, shane cummins <[email protected]> wrote:

> Hi all after recently changing over from AWX to AAP and changing from the
> community.VMware collection to VMware.rest collection.
> I am running into some issues when deploying I am using the module,
> *VMware.vmware_rest.content_library_item_info:*
> deploying the VM from a template in the content library,
> I am able to deploy the VM from the template without any problems,
> using the below playbook.
> but the issue I have is the newly deployed VM keeps the name of the,
> name of the template the VM was created from and does not change the name
> at guest level,
> just changes on the label of the VM.
>
>
> ---
> - name: Deploy a VM from a library "Linux_Templates"
>   hosts: localhost
>   gather_facts: yes
>
>   vars:
>     hostname: "{{ lookup('env', 'VMWARE_HOST') }}"                 #
> vCenter Server hostname or IP address
>     username: "{{ lookup('env', 'VMWARE_USER') }}"                 #
> vCenter Server username
>     password: "{{ lookup('env', 'VMWARE_PASSWORD') }}"             #
> vCenter Server password
>     vm_name: "{{new_name}}"                                        # Name
> to give to the new VM
>     esxi_hostname: "esx node name"                      #ESX node name
>     datastore: "datastore name"                                          #
> Name of the datastore to use
>     cluster_ID: "cluster name"                                       #
> Cluster name
>     folder_path: "folder path name"                                   #
> Name of the folder to place the new VM in
>     content_library: "content library id"
>     library_item: "item id"
>     AD_Domain: "domain name"                                       #
> Domain name
>     AD_Domain_alt: "alt domain name"                                   #
> Alternative domain name
>     sudo_users: "{{sudo_user_add}}"                                # Sudo
> users to add to vm
>
>
>   tasks:
>
>     - name: get the list of items of the NFS library
>       vmware.vmware_rest.content_library_item_info:
>         vcenter_hostname: "{{hostname}}"
>         vcenter_username: "{{username}}"
> vcenter_password: "{{password}}"
>         library_id: "{{content_library}}"
>         library_item_id: "{{library_item}}"
>       register: content_library_result
>
>     - name: Create a new VM based on the template
>       vmware.vmware_rest.vcenter_vmtemplate_libraryitems:
>         vcenter_hostname: "{{hostname}}"
>         vcenter_username: "{{username}}"
> vcenter_password: "{{password}}"
>         name: "{{vm_name}}"
>         vcenter_validate_certs: false
>         library: "{{content_library}}"
>         template_library_item: "{{library_item}}"
>         placement:
>           cluster: "{{cluster_ID}}"
>           folder:  "{{folder_path}}"
>           #resource_pool:  "{{
> lookup('vmware.vmware_rest.resource_pool_moid',
> '/my_dc/host/my_cluster/Resources')}}"
>         state: deploy
>         powered_on: True
>       register: my_new_vm
>
>     - name: Pause for 1 minutes for server to boot up
>       ansible.builtin.pause:
>         seconds: 30
>
> also when using the community collection i was able to just also add a
> task you use bash shell,
> after VM was deployed in the same playbook like below
> - name: "Join the VM to the Domain"
>       shell: |
>          timeout 60s echo '{{vcenter_password}}' | sudo realm join
> --verbose exsample.COM -U 'user' --install=/ any help would be appreciated
> here
>
> thanks
> Shane
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/d737ed35-b86d-4f9e-b55c-b1ca2e486f33n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/d737ed35-b86d-4f9e-b55c-b1ca2e486f33n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAF8BbLZ46UdmP0W6-R3Saf0wXabh-EmpBcUfCysdDDjmCRFxxQ%40mail.gmail.com.

Reply via email to