Score:0

IP not getting assigned to VM created using ansible script

vi flag

I have created a VM using ansible script. IP is not getting assigned to VM even if we give static IP. And in vsphere client it is showing blank for IP Address.

---
- hosts: 127.0.0.1
  connection: local
  gather_facts: no
  vars_files:
    - variables.yml
  tasks:
    - name: Create a ubuntu vm using ansible       
      vmware_guest:
        hostname: "{{vsphere.hostname}}"
        username: "{{vsphere.username}}"
        password: "{{vsphere.password}}"
        validate_certs: no
        datacenter: "{{vsphere.dcenter}}"
        name: "vm{{item}}"
        esxi_hostname: "{{vsphere.esxi_host_ip}}"
        folder: "/Datacenter/vm"
        template: "{{vsphere.Fedora-template}}"
        datastore: "{{vsphere.datastore}}"
        # hardware:
        #   memory_mb: 4096
        #   num_cpus: 4
        networks:
         - name: VM Network
           type: static
           hostname: testvm
           username: root
           password: P@ssw0rd
           ip: 10.165.9.10
           netmask: 255.255.255.0
           device_type: vmxnet3
           #gateway: 10.165.1.1
           start_connected: true
           state: new
           connected: true
        wait_for_ip_address: yes
        state: poweredon
      with_sequence: 0-9
      delegate_to: localhost

enter image description here

user20663427 avatar
vi flag
Any help is appreciated in before.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.