This is my entire task for creating a VM = works for Windows and Linux.
- name: create the guest vm using template
community.vmware.vmware_guest:
validate_certs: no
hostname: "{{ vcenter[location|lower].vc }}"
datacenter: "{{ vcenter[location|lower].dc }}"
cluster: "{{ vcenter[location|lower].cl }}"
name: "{{ vm_guest_name | lower }}"
state: poweredoff
template: "{{ os_type }}"
folder: "{{ esx_folder }}"
datastore: "{{ vcenter[location|lower].ds }}"
hardware:
hotadd_cpu: yes
hotadd_memory: yes
memory_mb: "{{ vm_spec[vm_size].ram }}"
num_cpus: "{{ vm_spec[vm_size].cpu }}"
networks:
- name: "VLAN_{{ vlan }}"
type: dhcp
start_connected: yes
connected: yes
wait_for_ip_address: no
delegate_to: localhost
register: newvm
Does the folder where you place your VM have permission to the VLAN to which
you are attaching? Seems like this is an environment related issue and not an
ansible issue.
Walter
--
Walter Rowe, Division Chief
Infrastructure Services, OISM
Mobile: 202.355.4123
On Jun 13, 2022, at 12:11 PM, Chris Bachmeyer
<[email protected]<mailto:[email protected]>> wrote:
Hey Walter,
Yeah, for sure. I've double checked this a number of times.
Regarding the ipv6 info Ansible was spitting to stdout, my best guess is this
is coming from the vm level. It does not appear to be interfering with any of
the builds, etc.
If necessary, I can have one of the SA's remove IPv6, either disabling or
uninstalling it, and recreating a win vmware template.
While I still do not understand the root cause of the underlying issue with
automated windows builds on vmware, I was able to overcome the issue.
I removed the network adapter from the vmware template and recreated a new
template to use. I’ve tested the builds mainly using dhcp but statically
assigned IP addresses should work without issue.
Alternatively, it may be possible to write a few tasks in Ansible to create a
windows vm while leaving it off, remove the adapter, and then add
a new adapter. This may work in addition to creating a new template without
the adapter. I have yet to test this though.
It would be really beneficial to understand the root cause of the adapter issue
on windows builds.
On Mon, Jun 13, 2022 at 5:43 AM 'Walter Rowe' via Ansible Project
<[email protected]<mailto:[email protected]>>
wrote:
Are you sure your vDS Name is accurate for the VLAN you are want to be attached?
On Tuesday, June 7, 2022 at 3:41:25 PM UTC-4
[email protected]<mailto:[email protected]> wrote:
It’s prob in your template or VM that you are cloning. Check there and disable.
Sent from my iPhone
On Jun 7, 2022, at 3:33 PM, Christopher Bachmeyer <[email protected]> wrote:
Still no dice. I made the changes but I seem to be getting hung-up on an
ipv6 address assignment which makes no sense.
I am not using ipv6 and don't have anything in the code either.
This is the stdout from Ansible ...
"ipaddresses": [
"fe80::7990:4f2e:dfba:fcf5",
"<ipv4>",
"169.254.252.245"
],
"ipv4": null,
"ipv6": "fe80::7990:4f2e:dfba:fcf5",
On Tuesday, June 7, 2022 at 7:58:30 AM UTC-6 Christopher Bachmeyer wrote:
Hi, Norm,
My apologies for not seeing this post earlier. No updates actually came to my
inbox ..
Thanks for the work, really appreciate it. I'll give this a go this morning
and see what happens!
On Monday, June 6, 2022 at 2:50:45 PM UTC-6 [email protected] wrote:
Chris,
I got the windows VM to poweron with the network connected with this
configuration. Hope this helps.
Ansible: 2.9 Tower: 3.8.2
* Compatibility: ESXi 6.7 Update 2 and later (VM version 15)
* VMware Tools: Running, version:11297 (Current)
- name: "Create VM {{ vmware_provision_vm_hostname_long }} with IP {{
vmware_provision_vm_network_ip_addr }}"
community.vmware.vmware_guest:
datacenter: '{{ vmware_provision_datacenter }}'
cluster: '{{ vmware_provision_vm_cluster }}'
datastore: '{{ vmware_provision_vm_datastore }}'
name: '{{ vmware_provision_vm_hostname_long }}'
template: '{{ vmware_provision_vm_template }}'
folder: '{{ vmware_provision_vm_folder }}'
networks:
- name: '{{ vmware_provision_vm_network_name }}'
ip: '{{ vmware_provision_vm_network_ip_addr }}'
netmask: '{{ vmware_provision_vm_network_ip_netmask_addr }}'
gateway: '{{ vmware_provision_vm_network_ip_gateway_addr }}'
type: "static"
start_connected: true
wait_for_ip_address: true
delegate_to: localhost
On Fri, May 27, 2022 at 11:14 AM Christopher Bachmeyer <[email protected]>
wrote:
Hi, Norm,
I have read about that issue in the forums regarding Perl and vmware tools on
RHEL/ CentOS. As far as I know, Windows does not need Perl ... ?
I read on a forum post that someone found a vDS was somehow at the root of this
issue which is, of course, what I am using as the network. That
gentleman switched over to a simple vswitch which seemed to alleviate this
issues.
You can read about it here along with a few other leads:
https://github.com/ansible/ansible/issues/24506
Sure, great! I've redacted sensitive info. The content within angle brackets
indicate redacted or changed content.
I am trying to work with a Windows2019 template.
---
# Ansible play to create a virtual vmware within a vSphere environment
# Extra Variables are declared in the Ansible play but assigned in Template
# Extra Vars include: "memory", "vm_name", and "template"
- name: Ansible play for the creation of a virtual machine within vSphere
hosts: localhost
#connection: local
gather_facts: no
vars:
cluster_name: <"My Test Cluster">
datacenter_name: <Hoth>
vcenter_server: <My.Vcenter.server>
datastore_name: <Hoth_datatore>
tasks:
- name: Create a virtual machine within a particular vSphere cluster.
vmware_guest:
hostname: "{{ vcenter_server }}"
validate_certs: false
name: "{{ vm_name }}"
state: poweredon
template: "{{ template }}"
datacenter: "{{ datacenter_name }}"
folder: /{{ datacenter_name }}/vm
cluster: "{{ cluster_name }}"
datastore: "{{ datastore_name }}"
hardware:
memory_mb: "{{ memory | int }}"
num_cpus: 2
num_cpu_cores_per_socket: 2
networks:
- name: <vDS network>
ip: <static_ip>
netmask: <mask>
type: static
gateway: <gateway_ip>
connected: true
start_connected: true
dns_servers:
- <dns_1 ip>
wait_for_ip_address: true
customization:
existing_vm: true
hostname: "{{ vm_name }}"
dns_servers:
- <dns_1 ip>
- <dns_2 ip>
domainadmin: "{{ admin }}"
domainadminpassword: "{{ admin_pass }}"
joindomain:
sncorp.com<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fsncorp.com%2F&data=05%7C01%7Cwalter.rowe%40nist.gov%7Cd67386be71684784629c08da4d57be2f%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C637907336498373951%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=aoIjtBfkigNmS2hl4JOqJTpeJZ9L57w60LqycY8eBSg%3D&reserved=0>
# wait_for_customization: yes
delegate_to: localhost
I just noticed I am not using the "guest_id" param but according to the docs, I
do not need this as I am deploying from a template.
Thanks for taking a look, much appreciated!
On Friday, May 27, 2022 at 2:45:21 AM UTC-6 [email protected] wrote:
Christopher,
I had a similar issue with RHEL. I found that the image/template that I was
using to build my VM was missing a perl module. I’ll have to check my notes
for which module. Once I installed that module in my image template, it worked.
I now need to do the same and get windows VMs spun up. Would you mind sharing
your playbook? I have a test environment and I would be willing to help
troubleshoot your issue.
Regards,
Norm
Sent from my iPhone
On May 26, 2022, at 11:05 PM, Christopher Bachmeyer <[email protected]>
wrote:
We're on Ansible Tower 3.8.3 and Ansible core is 2.9.x.
I am trying to use the community.vmware collection and looking to deploy
Windows and Linux vms to vSphere.
When deploying Windows 2019 vms, the network adapter is always disconnected.
It seems like many are having issues with the same issue but there are few if
any solutions.
Any suggestions?
Thanks!
On Wednesday, March 31, 2021 at 5:38:32 AM UTC-6 [email protected] wrote:
I'm using Ansible Tower 3.8.2.
Ansible core is 2.9.15
I'm using the vmware_rest collection.
I'm able to get the linux VM created from a template. And the VM does poweron.
But when it comes up the network adapter does not. It is in disconnected
state.
My linux VM is RHEL 8.2
I see online that many folks have had this issue but I'm not seeing what the
solution is for it.
Can anyone offer any tips that may help me solve this problem?
Thanks,
Norm
--
You received this message because you are subscribed to a topic in the Google
Groups "Ansible Project" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/ansible-project/wsdacUC7Gz4/unsubscribe<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Ftopic%2Fansible-project%2FwsdacUC7Gz4%2Funsubscribe&data=05%7C01%7Cwalter.rowe%40nist.gov%7Cd67386be71684784629c08da4d57be2f%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C637907336498373951%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=du1i0DtvUp4c3Lc3lKBUrHaCM5%2FxjqiHCHhl%2FaDcI3o%3D&reserved=0>.
To unsubscribe from this group and all its topics, send an email to
[email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/37c0545e-9775-42bb-a1d6-7e48668eb123n%40googlegroups.com<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2F37c0545e-9775-42bb-a1d6-7e48668eb123n%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7Cd67386be71684784629c08da4d57be2f%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C637907336498373951%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=SbLWZVk4%2FOBowwsRdT3U%2BNuSRI38bihxLay4QVCAxLc%3D&reserved=0>.
--
You received this message because you are subscribed to a topic in the Google
Groups "Ansible Project" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/ansible-project/wsdacUC7Gz4/unsubscribe<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Ftopic%2Fansible-project%2FwsdacUC7Gz4%2Funsubscribe&data=05%7C01%7Cwalter.rowe%40nist.gov%7Cd67386be71684784629c08da4d57be2f%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C637907336498373951%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=du1i0DtvUp4c3Lc3lKBUrHaCM5%2FxjqiHCHhl%2FaDcI3o%3D&reserved=0>.
To unsubscribe from this group and all its topics, send an email to
[email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/83802d17-e792-4308-8ddf-ed8eece46d58n%40googlegroups.com<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2F83802d17-e792-4308-8ddf-ed8eece46d58n%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7Cd67386be71684784629c08da4d57be2f%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C637907336498373951%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=nAPXznsmBYsR3d7DPBm2DTHUUF7iBE5TYTKUKUJCcBU%3D&reserved=0>.
--
You received this message because you are subscribed to a topic in the Google
Groups "Ansible Project" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/ansible-project/wsdacUC7Gz4/unsubscribe<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Ftopic%2Fansible-project%2FwsdacUC7Gz4%2Funsubscribe&data=05%7C01%7Cwalter.rowe%40nist.gov%7Cd67386be71684784629c08da4d57be2f%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C637907336498373951%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=du1i0DtvUp4c3Lc3lKBUrHaCM5%2FxjqiHCHhl%2FaDcI3o%3D&reserved=0>.
To unsubscribe from this group and all its topics, send an email to
[email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/8568f738-c967-4030-99d0-ae0e0280939an%40googlegroups.com<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2F8568f738-c967-4030-99d0-ae0e0280939an%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7Cd67386be71684784629c08da4d57be2f%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C637907336498373951%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=3LBokucv5OZiU8mB4Q3nIn9IE1i73%2Bjgf%2BGznIikRlY%3D&reserved=0>.
--
You received this message because you are subscribed to a topic in the Google
Groups "Ansible Project" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/ansible-project/wsdacUC7Gz4/unsubscribe<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Ftopic%2Fansible-project%2FwsdacUC7Gz4%2Funsubscribe&data=05%7C01%7Cwalter.rowe%40nist.gov%7Cd67386be71684784629c08da4d57be2f%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C637907336498373951%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=du1i0DtvUp4c3Lc3lKBUrHaCM5%2FxjqiHCHhl%2FaDcI3o%3D&reserved=0>.
To unsubscribe from this group and all its topics, send an email to
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/40433129-4ddf-4c24-9bf9-202d442d8c1fn%40googlegroups.com<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2F40433129-4ddf-4c24-9bf9-202d442d8c1fn%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7Cd67386be71684784629c08da4d57be2f%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C637907336498373951%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=mcDEVJRxXHKAesKyhfpw4muELyRCP0G8P756E3d3gko%3D&reserved=0>.
--
You received this message because you are subscribed to a topic in the Google
Groups "Ansible Project" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/ansible-project/wsdacUC7Gz4/unsubscribe<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Ftopic%2Fansible-project%2FwsdacUC7Gz4%2Funsubscribe&data=05%7C01%7Cwalter.rowe%40nist.gov%7Cd67386be71684784629c08da4d57be2f%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C637907336498373951%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=du1i0DtvUp4c3Lc3lKBUrHaCM5%2FxjqiHCHhl%2FaDcI3o%3D&reserved=0>.
To unsubscribe from this group and all its topics, send an email to
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/CAHLuxN0oofyvyJC7eWkOLiywCND%3D4g%2BAc2b18qyjdrzVXhUjYg%40mail.gmail.com<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2FCAHLuxN0oofyvyJC7eWkOLiywCND%253D4g%252BAc2b18qyjdrzVXhUjYg%2540mail.gmail.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7Cd67386be71684784629c08da4d57be2f%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C637907336498373951%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=01A68qrAqNt%2FwmZhbug82Fahezk%2FrlVwxVJf0VTSEds%3D&reserved=0>.
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/C50D29F1-7C2D-4766-8594-74F6B685E82E%40nist.gov.