Ansible deploy in vCenter

Hello all,

I am trying to find an example of deploying the OVA in vcenter via ansible. I can spin up VM but guest services are failing to configure interfaces post deployment. The end goal is to be able to variablize three interface IP’s and apply within VyOS on deployment.

Does anyone have an example of how this can be done? I see that there is a cloud-init OVA with a few enabled modules as well. Does anyone have an example of deploying the OVA (via ansible) and passing cloud-init parameters (or a .cfg) during deployment?

I dont usually post on forums and have been googling for about a day now. Kinda at my wit’s end. Any assistance is greatly appreciated.

What version of vmware and are the latest version of vmware-tools installed to the template? Beginning vSphere 7.0 some security options were thrown in that stops enable-custom-scripts unless turned on pre-customization.

Have a look at Creating and Managing Customization Specifications (6.5 but link is present to change to more current version)

Do you mind sharing your current playbook and template settings? Redact anything sensitive. I have 6.5 to test on.

We are running vSphere 7.


    hostname: '{{ vcenter_hostname }}'
    username: '{{ vcenter_username}}'
    password: '{{ vcenter_password }}'
    validate_certs: no
    datacenter: '{{ vcenter_datacenter }}'
    cluster: '{{ vcenter_cluster }}'
    folder: '{{ vcenter_folder }}'
    name: '{{ inventory_hostname }}'
    state: poweredon
    convert: 'thin'
    # to temp1
    - name: "temp1"
      ip: '{{ ansible_host_temp1 }}'
      netmask: '{{ guest_netmask }}'
      start_connected: True
    # to temp2
    - name: "temp2"
      ip: '{{ ansible_host_temp2 }}'
      #gateway: '{{ guest_gateway }}'
      netmask: '{{ guest_netmask }}'
      start_connected: True
    # to temp3
    - name: "temp3"
      ip: '{{ ansible_host_temp3 }}'
      netmask: '{{ guest_netmask }}'
      start_connected: True
      memory_mb: '{{ vyos_guest_memory }}'
      num_cpus: '{{ vyos_guest_vcpu }}'
    template: '{{ vyos_guest_template }}'
    wait_for_ip_address: yes
  delegate_to: localhost
# test Hosts
[vyos_temp] ansible_host_temp1= ansible_host_temp2= ansible_host_temp3= guest_netmask=24

That is about the gist of it. The template is the OVA from the VyOS download page–unmodified.

Well I was going to try it on my company’s lab but looks like my vcenter perms were changed. I’ve asked about getting them restored. Might be a day or so before I can play with this :frowning:

There’s another ova image that has cloud-init included, may want to try grabbing that as well. After I can get a machine deployed I’ll work on deploying via API.

I appreciate your efforts.