i'm currently working on a project, to automate VM deployment, based on template. To proceed I'm using Ansible 2.10, and Pyvmomi 7.0.1.
I'm facing an issue trying to define a Pvlan id (51), to my guest, here's my playbook :
---
- hosts: localhost
gather_facts: no
vars:
vcenter_server: "100.64.31.5"
vcenter_user: "xxxxx"
vcenter_pass: 'xxxxxx'
datacenter_name: "xxxxxx"
cluster_name: "xxxxxx"
tasks:
- name: Clone the template
vmware_guest:
hostname: "{{ vcenter_server }}"
username: "{{ vcenter_user }}"
password: "{{ vcenter_pass }}"
validate_certs: False
name: NewVmName
template: "mytemplate"
datacenter: "{{ datacenter_name }}"
folder: "/vm"
cluster: "{{ cluster_name }}"
datastore: "SAN08T2lunHDS1"
networks:
- vlan: 51
ip: 100.64.67.13
netmask: 255.255.240.0
type: static
But I keep getting the following error :
AttributeError: 'vim.dvs.VmwareDistributedVirtualSwitch.PvlanSpec' object has no attribute 'vlanId'
I already checked my user permissions on Vswitch, Datastore an VM, nothing to declare on this side.
vim.dvs.VmwareDistributedVirtualSwitch.PvlanSpec
, where it is declared and precisely it is used because there is not a single clue about that in your post. – Zeitounator