Giter Club home page Giter Club logo

ans-pve-win-templ's Introduction

ans-pve-win-templ

Summary

Ansible playbook to create Windows templates for Proxmox (PVE) based lab environment (somewhat customized for mine, but easy enough to tweak), prepped for further Ansible automation. Tested with Proxmox v6.0.1 & Ansible v2.8.1.

Goals:

  • Create a base Windows Server 2019 template image for Proxmox VE
  • Start with only a base ISO from Microsoft (no other components like MDT necessary)
  • Apply necessary VirtIO drivers (to run on Proxmox/KVM) during Windows Setup
  • Pre-configure Windows image for Ansible to allow for further downstream configuration
  • Apply latest Windows Updates as of image build
  • Allow for minor customization to image via variables passed to either AutoUnattend.xml file, or to qemu provisioner (ex: name, resource specs, admin password, time zone, Windows image version, etc)
  • Sysprep and templatize the image

Usage

  • Modify variables in vars.yml as appropriate
  • Populate proxmox hosts in inventory.yml with the PVE hosts on which to create a template VM. If using shared storage, this only needs to be one host.
  • For secure vars (passwords) in both inventory.yml & vars.yml, as alternative to clear text, use Ansible Vault or pass variables on command line to ansible-playbook.

ansible-playbook -i inventory.yml --ask-vault-pass provision-template.yml

Requirements

  • Windows Server ISO (eval is fine) available to Proxmox node(s). Update 'os_iso_location' in vars.yml to reflect the location of the PVE storage and ISO file name.
  • Additional VirtIO drivers added (/drivers/virtio folder) if necessary. Repo includes VirtIO SCSI, NIC (NetKVM), Balloon drivers and qemu guest agent.
  • Genisoimage installed on Proxmox host (present by default)

Why Not Packer? (And Other Misc Notes)

  • Packer would be ideal solution for this, using the Proxmox builder, which works great for an OS that can be supplied a kickstart config over http, but for Windows, to use the Unattend.xml automated setup capability, there are two issues:

    • Proxmox does not support floppy drives, so using a 2nd ISO / CDROM image is required (also used for VirtIO drivers)
    • The Packer Proxmox builder does not support (at time of writing) adding more than one ISO. Related Github issue.
  • Unable to use Packer, next looked to use Proxmox_KVM Ansible module. However found multiple issues with this, including:

    • Bug related to Proxmox v6 version numbering scheme, which caused outright module failure. The issue & fix are in this pull request, but at time of writing, still open & unmerged. Editing the proxmox_kvm.py as described in PR is a workaround
    • Multiple issues with the module's clone operation, incl: changes OSType back to Linux, does not allow disk resizing, does not allow modifying RAM or CPU resources, does not allow addition of another disk or CDROM, does not allow changes to network interface. Some of these are described in this issue, and this pull request.
    • Issues above, plus a few other minor ones, made using proxmox_kvm module an unattractive option; generally seems like both Packer builder and Ansible module aren't fully developed.
  • Ultimately found solution by using qm command line tool from Ansible command module.

  • There are a couple of 'Start-Sleep' calls in the AutoUnattend.xml file. The method is a bit kludgy, but has been the only reliable method I've found to allow for 2 Windows Updates passes with reboots, and also ensure that the final phase for Sysprep is not interrupted.

ans-pve-win-templ's People

Contributors

clayshek avatar

Watchers

 avatar  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.