Building a VM using Ansible Tower

35 views
Skip to first unread message

Sindhu Rao

unread,
Feb 21, 2020, 6:58:21 PM2/21/20
to Ansible Project
I'm building a VM on Vcenter with a playbook that runs fine and creates a VM when executed from the Ansible server but fails to create a VM when the same playbook is executed from ANsible Tower.
I do not see any syntax errors and I see the same job output on both the Ansible server and on Ansible Tower. I'm not sure if there is a difference in vmware_guest module for Tower or with versions. 

My playbook is
---
    - name: Create a VM
      vmware_guest:
        hostname: "{{ hostname_esxi }}"
        username: ansible.pfshq.com
        password: #####
        validate_certs: False

        datacenter: "{{ datacenter }}"

        resource_pool: "{{ resource_pool_esxi }}"
        cluster: "{{ cluster_esxi }}"
        guest_id: "{{ guest_id }}"
        folder: "/{{ datacenter }}/vm"
        state: poweredon
        annotation: "{{ annotation }}"
# hostname gets passed in command line as extra arguments -e hostname=xxxxxxx
        name: "{{ hostname }}"
        hardware:
          memory_mb: "{{ memory_esxi }}"
          num_cpus: "{{ cpu_esxi }}"
          scsi: "{{ scsi_esxi }}"
        wait_for_ip_address: yes
        disk:
        - size_gb: "{{ disk_size_1 }}"
          type: "{{ disk_type }}"
  
          datastore: "{{ datastore_cluster_1 }}"
        - size_gb: "{{ disk_size_2 }}"
          type: "{{ disk_type }}"

          datastore: "{{ datastore_cluster_2 }}"
        networks:
        - name: "{{ network_name }}"
          domain: "{{ domain }}"
          device_type: "{{ device_type }}"
          dns_servers:
          - "{{ dns1 }}"
          - "{{ dns2 }}"
      delegate_to: localhost
      register: VM

Dan Linder

unread,
Feb 23, 2020, 3:20:14 PM2/23/20
to Ansible Project
> I'm not sure if there is a difference in vmware_guest module for Tower or with versions. 

If the output is the same between Ansible Engine and Ansible Tower, then that would be my first though.  Check the versions Tower and your test system are using and make sure Tower is the same version.
Reply all
Reply to author
Forward
0 new messages