GithubHelp home page GithubHelp logo

kayari75 / packer-rhel-vsphere-horizon-iso Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rebelinux/packer-rhel-vsphere-horizon-iso

0.0 0.0 0.0 28 KB

RHEL 9.1 vm build with packer intended for use with VMware Horizon VDI

Shell 50.21% PowerShell 0.70% HCL 49.09%

packer-rhel-vsphere-horizon-iso's Introduction

๐Ÿ”ฐ packer-rhel-vsphere-horizon-iso

This repo builds automatically RHEL VM templates (RHEL 22.04) for VMware vSphere and Horizon environment using Hashicorp's Packer.

RHEL ISO files gets downloaded from vCenter Datastore.

๐Ÿ“š How to use this repo

๐Ÿ”ง Pre-requesites

Download or git clone https://github.com/rebelinux/packer-rhel-vsphere-horizon-iso this repo and make sure you have Packer Version 1.8.5 or later installed. If you don't know Packer, it's a single commandline binary which only needs to be on your PATH.

Step 1: Adjust variables

Rename the file variables.auto.pkrvars.hcl.sample to variables.auto.pkrvars.hcl and adjust the variables for your VMware vSphere environment. Some documentation on each variable is inside the sample file.

mv variables.auto.pkrvars.hcl.sample variables.auto.pkrvars.hcl
nano variables.auto.pkrvars.hcl

Option 1: Local Horizon Agent File (Default)

Copy the Horizon Agent installation file to the ./files/ folder:

[rebelinux@rebelpc packer-rhel-vsphere-horizon-iso]$ ls -alh files/
total 127M
-rw-r--r-- 1 0 Apr 13 21:20 Place_Here_Horizon_Agent_Files.txt
-rw-r--r-- 1 127M Apr 10 08:31 "VMware-horizonagent-linux-x86_64-2303-8.9.0-21434177.tar.gz"
[rebelinux@rebelpc packer-rhel-vsphere-horizon-iso]$

Option 2: Use vCenter as a Web Server to host Horizon Agent File

Save the Horizon agent installation files to a staging Datastore

Sample vSphere Staging Datastore

Get the Horizon agent file URL from the Browse datastores in the vSphere inventory

Copy URL

Next, uncomment line (292:296) and paste the vCenter URL like the provided example:

  provisioner "shell" {
   inline = [
     "curl -k --user '${var.vsphere_username}:${var.vsphere_password}' -X GET -o ./${var.horizon_agent_file} --output-dir '/tmp/' 'https://vcenter-01v.lab.local/folder/ISO%2fVMWARE%2fHorizon/VMware-horizonagent-linux-x86_64-2303-8.9.0-21434177.tar.gz?dcPath=PHARMAX-VSI-DC&dsName=HDD-VM-ISO-LOW-PERF'" 
     ]
  }

Step 2: Init Packer

Init Packer by using the following command. (Spot the dot at the end of the command!)

packer init .
packer validate .

Step 3: Build a VM Template

To build a VM template run one of the provided build-scripts. For example to build a RHEL 9.1 template run:

./build-rhel9.sh

If you are on a Windows machine then use the build-rhel9.ps1 files.

./build-rhel9.ps1

๐Ÿ’ป Optional: Template default credentials

The default credentials after a successful build are Username: godadmin Password: godadmin

If you would like to change the default credentials before a packer build, then you need to edit the following files:

  • variables.auto.pkrvars.hcl (Line 41:49)

To generate an encrypted password use the following command:

mkpasswd -m SHA-512 --rounds=4096

๐Ÿ“‹ Template Variables

# Name or IP of you vCenter Server
vsphere_server          = "vcenter.demolab.com"

# vsphere username
vsphere_username        = "[email protected]"

# vsphere password
vsphere_password        = "SomeSecurePassword"

# vsphere datacenter name
vsphere_datacenter      = "datacenter1"

# vsphere cluster name
vsphere_cluster           = "esx1.demolab.com"

# vsphere folder name
vsphere_folder           = "folder"

# vsphere network
vsphere_network         = "VM Network"

# vsphere datastore
vsphere_datastore       = "datastore1"

# vsphere VM Name
vsphere_vm_name         = "hz-tpl-rhel-9"

# RHEL boot command
boot_command            = ["<up><wait><tab><wait> inst.text inst.ks=cdrom:/ks.cfg <enter><wait>"]

# final clean up script
shell_scripts           = [
    "./setup/packages.sh",
    "./setup/desktop_postinstall.sh",
    "./setup/ad_domain_join.sh",
    "./setup/horizon_agent_install.sh",
    "./setup/cleanup.sh"
    ]

# RHEL OS Settings
vm_guest_os_language = "en_US.UTF-8"
vm_guest_os_keyboard = "us"
vm_guest_os_timezone = "UTC"

# SSH username
build_username = "godadmin"

# SSH password
build_password = "godadmin"

build_password_encrypted = "$6$rounds=4096$Y0SjrsU5WHubYJvb$0BJhswGEAokE2OqlRFTgiUhJnquzDt2hAnrb3.g3DNTATZ01VLNbxlLRLMLk.PTHiMeP8fUg9WfVx.HeL7e8E0"

# ISO Objects
iso_path = ["[vmware-nfs] /iso/rhel-baseos-9.1-x86_64-dvd.iso"]

# NTP Server
ntp_server = "changeme"

# AD Domain
ad_domain = "CHANGEME"

# AD Domain join password
join_password = "changeme"

# AD Domain join username
join_username = "changeme"

# Horizon Agent install file location
# horizon_agent_datastore = "HDD-VM-ISO-LOW-PERF"
# horizon_agent_path = "/ISO/VMWARE/Horizon/"
# horizon_agent_file = "VMware-horizonagent-linux-x86_64-2303-8.9.0-21434177.tar.gz"

# The credential to register Red Hat Subscription Manager
rhsm_username = "changeme"
rhsm_password = "changeme"

packer-rhel-vsphere-horizon-iso's People

Contributors

rebelinux avatar

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.