Gowthu
January 28, 2025, 3:48am
1
Hello everyone,
I am seeking assistance with cloning an OVF template from a content library using Ansible. Specifically, I would like to know which Ansible components are available for this task and how to retrieve the OVF and OVA path or URL.
I am currently using the following module in my Ansible playbook to clone a VM:
community.vmware.vmware_deploy_ovf:
hostname: “XYZ”
username: “XYZ”
password: “XYZ”
validate_certs: no
datacenter: “XYZ”
cluster: “XYZ”
datastore: “XYZ”
folder: “XYZ”
name: “XYZ”
ovf: “{{ ovf_path }}”
networks:
“XYZ”:
ip: “XYZ”
netmask: “XYZ”
gateway: “XYZ”
power_on: yes
delegate_to: localhost
One of the mandatory inputs is “ovf_path,” but I am unsure how to retrieve the path details in VMware. Is there any script available or a method to find the absolute OVF path or URL in VMware vSphere Client to execute the playbook successfully?
Any guidance or examples would be greatly appreciated. Thank you!!
That module is for deploying an OVF from your local machine (or whatever machine is running the ansible module).
To deploy an OVF from a content library, you should use
vmware_content_deploy_ovf_template_module
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2020, Lev Goncharov <lev@goncharov.xyz>
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = r'''
---
module: vmware_content_deploy_ovf_template
short_description: Deploy Virtual Machine from ovf template stored in content library.
description:
- Module to deploy virtual machine from ovf template in content library.
author:
- Lev Goncharv (@ultral)
requirements:
This file has been truncated. show original
This module was recently migrated to the new vmware.vmware collection:
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Ansible Project
# Copyright: (c) 2019, Pavan Bidkar <pbidkar@vmware.com>
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = r'''
---
module: deploy_content_library_ovf
short_description: Deploy a virtual machine from an OVF in a content library.
description:
- Create or destroy a VM based on an OVF in a content library.
- The module basis idempotentency on if the deployed VM exists or not, not the storage or deployment spec applied at deployment time.
author:
This file has been truncated. show original
It will be included in the next release in a few weeks