Project

General

Profile

Provision a new Virtual Machine using Ansible

Ansible
09/09/2025

Provision a new Virtual Machine

Use these standard operating procedure to provision a virtual machine. Note that currently this only supports an Ubuntu virtual machine.

Prep

  1. Create Inventory file

[vms]
host-1 vms_proxmox_node=pve-1 vms_clone=false

[linux]
host-1

  1. Prep group variables to configure the virtual machine parameters. This includes hardware and operating system
vms_config:
  agent: "1"
  cores: "4"
  cpu: host
  memory: 2048
  ostype: l26
  scsihw: virtio-scsi-single
  sockets: 1
  storage: local
  disk_os:
    disk: virtio0
    backup: true
    size: 20
    storage: local
  disk2:
    disk: virtio1
    backup: true
    size: 20
    storage: local

vms_os: ubuntu_24_server
vms_autoinstall: true
vms_enable_serial_terminal: false
vms_additional_packages: [jq]
  1. Prep host DNS settings. Edit roles/global/defaults/main/hosts.yml and add the hostname and allocate an available IP address.
global_ip_addresses:
   host-1: 192.168.2.123

 

Files