Giter VIP home page Giter VIP logo

vmware_terraform_create_vm_from_template's Introduction

Deploy a Virtual Machine from Template in vSphere 8.0

Welcome! This repository was designed to automate the deploy of a single VM from a template in vCenter 8.0 using Terraform.

Table of Contents

Getting Started

This project was developed and tested on an Intel NUC 13 Pro i5 with 64GB RAM, serving as the physical server. The server runs VMware ESXi 8.0, vCenter 8.0, and a VyOS server for communication within the home network and the internal lab.

Prerequisites

Ensure the following prerequisites are met before proceeding:

  • ESXi 6.7 or later
  • vCenter 6.7 or later
  • 01 template for use. Check out this link for instructions on creating a template using Packer. The provided template was used to create the template in vCenter.

Installation

Follow these steps for installation:

  1. Install Packer: Getting Started with Packer
  2. Install the vSphere plugin: Packer vSphere Plugin

Generating a Hashed Password for Identity in user-data

To generate a hashed password, follow the instructions in the official documentation. OpenSSL was used in this instance, but you can use mkpasswd from the whois package.

openssl passwd -6 -salt $(openssl rand -base64 12) ubuntu

Running Packer Build with HCL

Execute the following command to build with HCL:

packer build -force -on-error=ask -var-file variables.pkrvars100GBdisk.hcl -var-file vsphere.pkrvars.hcl ubuntu-22.04.pkr.hcl

Tree files

├── README.md
├── main.tf
├── output.tf
├── templates
│   ├── metadata.yaml
│   └── userdata.yaml
├── terraform.tfstate
├── terraform.tfvars
├── variables.tf
└── vars.auto.tfvars

This project follows the directory structure:

  • README.md: Project documentation.
  • main.tf: Main Terraform configuration file.
  • output.tf: Terraform output configuration file.
  • templates/: Directory containing metadata and userdata YAML templates.
    • metadata.yaml: Metadata YAML template.
    • userdata.yaml: Userdata YAML template.
  • terraform.tfstate: Terraform state file.
  • terraform.tfvars: Terraform variable values.
  • variables.tf: Terraform variable definitions.
  • vars.auto.tfvars: Auto-generated Terraform variable values.

Contact

If you have any questions, encounter issues, or have suggestions, please feel free to open an issue on GitHub or reach out to the maintainer at [email protected].

vmware_terraform_create_vm_from_template's People

Contributors

jcometti avatar

Watchers

 avatar

vmware_terraform_create_vm_from_template's Issues

1. Amend the code to deploy multiple instances.

Amend the code to deploy the VMs following the resource below.

Hostname | IP | Gateway | DNS | Hosted | CPU | Memory | Template
lab-k8s-m01 | 192.168.1.120/24 | 192.168.1.48 | 192.168.1.49 | esxi-p02.homelab.local | 02 | 8 GB | Ubuntu-2204-Template-100GB-Thin
lab-k8s-w01 | 192.168.1.121/24 | 192.168.1.48 | 192.168.1.49 | esxi-p02.homelab.local | 02 | 8 GB | Ubuntu-2204-Template-100GB-Thin
lab-k8s-w02 | 192.168.1.123/24 | 192.168.1.48 | 192.168.1.49 | esxi-p02.homelab.local | 02 | 8 GB | Ubuntu-2204-Template-100GB-Thin
lab-k8s-w03 | 192.168.1.124/24 | 192.168.1.48 | 192.168.1.49 | esxi-p02.homelab.local | 02 | 8 GB | Ubuntu-2204-Template-100GB-Thin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.