Ansible vmware_guest creates vmware vm, but hostname does not changes. Also creates a additional junk folder

27 views
Skip to first unread message

Ajay Sharma

unread,
Feb 8, 2018, 5:39:30 AM2/8/18
to Ansible Project

HI Everyone. this Ansible yaml script creates vmware vm from previous template, but does not changes its host name.  also creates a additional folder named 

here is the screen shot attached. The vmware_guest module creates Testmachine, but the hostname of the machine remains same when i login to centos machine. 

also creates a junk folder named as  "replica-e040a406-2f24-4c53-b719-67f42c1b9115"

Thanks in Advance. please give some solution. here is my yaml script attached. 

cat us_vm.yaml
---
- name: Deploy VM on 172.XX.X.XXX
  hosts: localhost
  gather_facts: no
  vars_prompt:
  - name: templatename
    prompt: Supply template name
    default: "CENTOS7-ENT-WWW-APACHE-DEFAULT"
    private: no

  - name: vm_name
    prompt: Supply VM Name to Be Created
    default: "TestMachine"
    private: no
  tasks:
    - name: Create a VM from USA template
      vmware_guest:
        hostname: 172.17.X.XXX
        username: XXXX\XXXXX
        password: XXXXd1
        datacenter: OSC-US-Datacenter-Other
        validate_certs: no
        folder: /VMwareViewComposerReplicaFolder
        name: "{{vm_name}}"
        state: poweredon
        template: "{{templatename}}"
        disk:
          - size_gb: 50
            type: thin
            datastore: 3PAR_Datastore01
        hardware:
          memory_mb: 512
          num_cpus: 1
          scsi: paravirtual
        networks:
          - name: "OSC VLAN 4 172.16.9.0"
            type: dhcp
        customization:
#         dns_servers:
#         - 172.16.XX.XX
#         - 172.16.XX.XX
         dns_suffix: XXXX.XXXXXield.com
         hostname: "{{vm_name}}"
        wait_for_ip_address: no
      delegate_to: localhost
      register: deploy
[root@OSIANSIBLEIND instance]#

Ajay Sharma

unread,
Feb 14, 2018, 7:50:53 AM2/14/18
to Ansible Project
Hi Everyone,

I would like to close this issue, as it is resolved. 
Reply all
Reply to author
Forward
0 new messages