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.

role

  vmware_guest:
    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'
    networks:
    # 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
    hardware:
      memory_mb: '{{ vyos_guest_memory }}'
      num_cpus: '{{ vyos_guest_vcpu }}'
    template: '{{ vyos_guest_template }}'
    wait_for_ip_address: yes
  delegate_to: localhost
  
  
inventory
  
# test Hosts
[vyos_temp]
vyos-temp.test.net ansible_host_temp1=10.20.1.1 ansible_host_temp2=172.20.1.1 ansible_host_temp3=10.20.2.1 guest_netmask=24

That is about the gist of it. The template is the OVA from the VyOS download page–unmodified. https://s3-us.vyos.io/1.2.9-S1/vyos-1.2.9-S1-simple-vmware.ova

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.